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

Slim down Autograph container #861

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

grahamalama
Copy link

The autograph container is large, which makes pulling it in CI pipelines pretty time consuming. I looked for anything we could do to make it smaller to speed up pulls, and I came up with these "quick wins":

  • build binaries in separate stage and copy to final stage
  • install deb packages with --no-install-recommends
  • remove apt-get lists as a cleanup step
  • add .git directory to .dockerignore

These changes make for a 44% reduction of the size of the compressed container

❯ ls -lah ../ | grep tar
-rw-r--r--@  1 gbeckley  staff   556M Oct 18 18:44 after.tar.gz
-rw-r--r--@  1 gbeckley  staff   998M Oct 18 18:21 before.tar.gz

- build binaries in separate stage and copy to final stage
- install deb packages with --no-install-recommends
- remove apt-get lists
- and .git directory to dockerignore
@grahamalama
Copy link
Author

This passed the integration test, though I noticed some of these in the output on CircleCI:

fatal: not a git repository (or any of the parent directories): .git

I'm guessing that comes from here

OUTPUT_BASENAME=autograph-$(git rev-parse --short HEAD)-$CONFIG-$(basename $INPUT_FILE '.zip')-PKCS7

Is the SHA itself important here? Maybe there's another value we can provide, or maybe it's not important in a CI setting? If we do need it, maybe we can provide it as a build arg or environment variable.

@hwine hwine added code quality code improvements and tidiness docker Pull requests that update Docker code pending resources labels Oct 24, 2023
@hwine
Copy link
Contributor

hwine commented Oct 24, 2023

N.B.: Remote settings does some gnarly stuff for testing. This is not a "guaranteed interface", but it'd be nice not to break it.

@jmhodges
Copy link
Contributor

jmhodges commented May 3, 2024

@grahamalama so, @oskirby updated the dockerfile in similar ways just now. Is there still stuff left on table for us to do?

@jmhodges
Copy link
Contributor

jmhodges commented May 3, 2024

(That comment was directed @grahamalama. Edited to be more clear!)

@grahamalama
Copy link
Author

@jmhodges did you mean to link to this PR? It seems to get more into the nitty gritty of the Dockerfile than #897.

I'm not seeing any PR that does quite the same thing as this one, but maybe these changes could be folded into one of the ones from @oskirby. #898 seems to make the image (just a bit) larger, but I don't see a reason why we couldn't apply similar strategies (multistage build, cleaning after we use apt, leverage .dockerignore) to a different base image.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code quality code improvements and tidiness docker Pull requests that update Docker code pending resources
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants