Skip to content

Install git-lfs to support Go modules with large-files #492

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
wants to merge 1 commit into from

Conversation

danielorbach
Copy link

@danielorbach danielorbach commented Sep 20, 2023

This pull-request installs git-lfs on the Linux images to support the download of Go modules from private repositories. The following is true even for public repositories that are downloaded directly (as opposed to downloading from a module-proxy).

The Go toolchain uses the local git installation to fetch archives of modules from Git servers directly. My company commits large files using Git LFS which happen to be part of our Go module source tree. Without git-lfs installed, the local git installation does not automatically resolve those files which causes "checksum mismatch" against the committed go.sum.

@yosifkit I have tested that the generated images in-fact resolve the Issue. I'd appreciate your review.
Looking for your guidance on getting this enhancement to the community,

@danielorbach danielorbach marked this pull request as ready for review September 20, 2023 17:43
@danielorbach danielorbach changed the title Install git-lfs Install git-lfs to support Go modules with large-files Sep 20, 2023
@LaurentGoderre
Copy link
Member

We usually explicitly avoid doing this and let downstream images add those. We had similar requests in the Node image for git to support package manager but if it's added in the base image it can't be removed in subsequent layers.

@yosifkit
Copy link
Member

We appreciate your contribution ❤️🙇

I agree with @LaurentGoderre that the added size would not acceptable for all users of the images. While useful, git-lfs isn't a core feature of git but an extension, and as such is not expected to be installed wherever git is.

For users that need git-lfs it is as simple as apt-get (or apk) installing it or downloading it from https://github.com/git-lfs/git-lfs/releases in their custom image.

FROM golang:1.21
RUN apt-get update && apt-get install -y git-lfs && rm -rf /var/lib/apt/lists/*

Similar issue/request: docker-library/buildpack-deps#112

@danielorbach
Copy link
Author

Thank you for your response @LaurentGoderre @yosifkit !

Would you like me to amend the Docker image documentation or just leave it as is?

@danielorbach
Copy link
Author

@LaurentGoderre @yosifkit Waiting on you instructions to close this pull-request...

@LaurentGoderre
Copy link
Member

@danielorbach documentation on how to do this would be very welcome!

@danielorbach
Copy link
Author

@LaurentGoderre I'd be glad to extend the documentation!

Can you point me to the appropriate repository? I am a bit lost regarding the many repositories involved.

@LaurentGoderre
Copy link
Member

@yosifkit correct me if im wrong but I think it's this file here: https://github.com/docker-library/docs/blob/master/golang/content.md

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

Successfully merging this pull request may close these issues.

4 participants