Skip to content

Go 1.11+ projects require git (alpine-based image) #297

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
PhilippHeuer opened this issue Aug 31, 2019 · 3 comments
Closed

Go 1.11+ projects require git (alpine-based image) #297

PhilippHeuer opened this issue Aug 31, 2019 · 3 comments

Comments

@PhilippHeuer
Copy link

In reference to the issue #238 which was closed with the following quote:

To minimize image size, it's uncommon for additional related tools (such as git or bash) to be included in Alpine-based images. Using this image as a base, add the things you need in your own Dockerfile (see the alpine image description for examples of how to install packages if you are unfamiliar).

Go 1.11+ projects that use go modules are not usable as go directly invokes the git binary which is not present in the container. Go modules are the most official way for projects right now and every project using this can not be build in the golang:alpine image.

I think the git dependency is a hard requirement, not optional/additional and would be happy if we can discuss adding it to the official image.

@tianon
Copy link
Member

tianon commented Sep 4, 2019

If you use -mod=vendor, git is definitely not required (although that does assume the project is using go mod vendor, which I don't think is really all that big of a leap -- vendoring is very popular in the Go community).

@leighmcculloch
Copy link

If you're dependent on source control tools you could also be dependent on mercurial and bazaar, depending on where your dependencies are hosted. It might make sense to install git, etc in an image you base on the alpine image to keep them lightweight.

The need for source control tools dissipates with Go 1.13 as that release uses the Go proxy to download tar files by default.

@PhilippHeuer
Copy link
Author

PhilippHeuer commented Oct 18, 2019

I already migrated to 1.13 but didnt know about that feature yet.
Thats great news, this resolves my issue and i don't have to maintain and update my own golang alpine image with git anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants