Skip to content

chore(dogfood): optimize dockerfile for envbuilder cache probing #14497

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

Merged
merged 2 commits into from
Aug 30, 2024

Conversation

mafredri
Copy link
Member

@mafredri mafredri commented Aug 30, 2024

This PR optimizes our dogfood Dockerfile for envbuilder caching/cache probing by reducing layer sizes and fixing an incompatible instruction.

@mafredri mafredri force-pushed the mafredri/fix-dogfood-docker-optimize-for-envbuilder branch from 172bc8d to c8b1add Compare August 30, 2024 12:10
@mafredri mafredri force-pushed the mafredri/fix-dogfood-docker-optimize-for-envbuilder branch from c8b1add to e4fae2f Compare August 30, 2024 12:11
@mafredri mafredri marked this pull request as ready for review August 30, 2024 12:11
ARG GOPATH="/tmp/"
RUN mkdir --parents "$GOPATH" && \
# Install Go utilities.
RUN apt-get install --yes gcc && \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should still just merge the gcc with the curl apt install above to save build time

Copy link
Member Author

@mafredri mafredri Aug 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can help cache utilization for when a Go tool version changes, but beyond that I don't see how there would be an improvement in build time?

Installing and uninstalling is a significant size optimization though:

sha256:ef2ad8c02872f01a9e71fc56afdf2ecda2a3d827ac61f5a9e1be0b096b79c335   About a minute ago   RUN /bin/sh -c apt-get install gcc --yes # buildkit                                                 159MB     buildkit.dockerfile.v0

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is install+cleanup:

sha256:b39c284ff9fac0da7a256f29de3116c5109f4f04e12291ded468314dde50b28a   19 seconds ago   RUN /bin/sh -c apt-get install gcc --yes && apt-get remove --yes gcc && apt-get autoremove --yes && apt-get clean # buildkit   1.64MB    buildkit.dockerfile.v0

I thought apt-get update was pretty innocent but it's actually 50MB too. 😅

@mafredri mafredri merged commit 13e5c51 into main Aug 30, 2024
26 checks passed
@mafredri mafredri deleted the mafredri/fix-dogfood-docker-optimize-for-envbuilder branch August 30, 2024 14:54
@github-actions github-actions bot locked and limited conversation to collaborators Aug 30, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants