alpine: add git for go get goodness#69
alpine: add git for go get goodness#69ruudud wants to merge 1 commit intodocker-library:masterfrom ruudud:alpine-add-git
go get goodness#69Conversation
|
+1 This is essential |
|
I went back and forth on this several times when I created the image, but I
decided against it specifically because the whole point of this image
variant is that it's as tiny as possible, so it felt wrong to bloat that
for a tool that's often useful but not universally necessary. I believe
even "cgo" will require the installation of additional tools. With
automated builds (https://docs.docker.com/docker-hub/builds/) and
repository links (
https://docs.docker.com/docker-hub/builds/#repository-links) and it's
reasonably easy to have an up-to-date image built FROM this one with git
and whatever else installed, so it felt like the right compromise,
especially since one can use this image entirely without git (for example,
if all dependnecies are already vendored in the repo being built).
|
|
Valid points indeed. Should this reasoning be documented somewhere? I guess it's quite common to want to have git available. |
|
Yeah, I think documenting this is a great idea -- over in
https://github.com/docker-library/docs would be the right place (since
that's where the image readme comes from), either in ".template-helpers/
variant-alpine.md" or in "golang/content.md" (not sure which would be
better, since only the latter is golang-specific).
|
|
yes lets document this. otherwise people will understandably assume that switching dockerfiles from "golang" to "golang:alpine" shouldn't break basic stuff like |
|
I wasn't planning on it -- for the |
|
(and I see the |
|
Regarding the docs, I looked into it now. Because of how the README is assembled, I can't really find a suitable place to put Go-Alpine-variant-specific stuff.
|
|
Yeah, something along those lines would be excellent!
|
|
@tianon - sorry for picking up such an old thread, but I was wondering if this might be worth reconsidering. I've only recently begun using alpine images in production and, up to now just use the base golang image for builds and then run the compiled binaries in alpine - no problem. (We build with CGO disabled.) A new app we're working with; however, makes use of a 3rd party cpp library and so we cannot build with CGO disabled. This is actually a particularly good use case for an alpine prod image b/c I can still add library dependencies here without a bloated ubuntu image. This seems to require; however, that I do my build an alpine so that I don't run into C library problems when running my CGO enabled app in an alpine prod image. The first step in my jenkins build script; however, is to do a go get, which fails in the golang:alpine image. Obviously there are numerous workarounds (one of which I will certainly use in the meantime). I am 100% in favor of keeping the golang:alpine image as small as possible, but my feeling is that we should at least have the dependencies installed so that all of the "go" native commands are functional out of the box. In the meantime I may well just add a the git install to my build script, but I would be interested to see what you think about this after 1 yr+. |
|
@CameronGo don't feel bad -- it's worth revisiting things every now and then! I'm definitely still of the opinion that VCSes that
|
git is already available in the non-alpine images, and is extremely useful for getting dependencies using the standard tools.