Go image size could be reduced
osechet opened this issue · 1 comments
osechet commented
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
andworkspace-go:after
Expected behavior
The image could be smaller.
Example repository
No response
Anything else?
No response
filiptronicek commented
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.