Skip to content
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

Go image size could be reduced #1146

Closed
osechet opened this issue Jul 26, 2023 · 1 comment · Fixed by #1195
Closed

Go image size could be reduced #1146

osechet opened this issue Jul 26, 2023 · 1 comment · Fixed by #1195
Labels
bug Something isn't working team: IDE

Comments

@osechet
Copy link
Contributor

osechet commented Jul 26, 2023

Bug description

The go image weights around 2.8 GB. By running go clean -cache -modcache after installing go tools, it could be reduced to 2 GB.

Steps to reproduce

From the chunks/lang-go,

  • run docker build --build-arg base=gitpod/workspace-base:2023-07-20-19-56-24 --build-arg GO_VERSION=1.20.6 -t workspace-go:before .
  • update the Dockerfile by adding go clean -cache -modcache after the go tools installation :
...
&& go install -v honnef.co/go/tools/cmd/staticcheck@latest \
&& go clean -cache -modcache
  • run docker build --build-arg base=gitpod/workspace-base:2023-07-20-19-56-24 --build-arg GO_VERSION=1.20.6 -t workspace-go:after.
  • run docker images
  • compare workspace-go:before and workspace-go:after

Expected behavior

The image could be smaller.

Example repository

No response

Anything else?

No response

@osechet osechet added the bug Something isn't working label Jul 26, 2023
filiptronicek added a commit that referenced this issue Oct 9, 2023
After we install the myriad of Go CLI tools, we are left with a hefty cache folder, which is included in the image.

This was originally described in #1146 and aims to improve the size of the image by almost a third.
@filiptronicek
Copy link
Member

Hey there @osechet, and thanks for the suggestion. From my perspective, it makes sense to remove all the tool cache and I will be raising a PR shortly.

filiptronicek added a commit that referenced this issue Oct 9, 2023
After we install the myriad of Go CLI tools, we are left with a hefty cache folder, which is included in the image.

Co-authored-by:  Olivier Sechet <[email protected]>

This was originally described in #1146 and aims to improve the size of the image by almost a third.
filiptronicek added a commit that referenced this issue Oct 9, 2023
After we install the myriad of Go CLI tools, we are left with a hefty cache folder, which is included in the image.

This was originally described in #1146 and aims to improve the size of the image by almost a third.

Co-authored-by: Olivier Sechet <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working team: IDE
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants