-
Notifications
You must be signed in to change notification settings - Fork 250
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
Switch to a slim debian Docker image [PLT-1610] #2521
Conversation
The slim image comes with far fewer packages pre-installed and we need to manually installed a handful that we need (like curl and build-essential), but in return we get: * A slightly smaller final image * Fewer debian packages installed, which means fewer CVEs will be detected
Preview URL: https://2521--bk-docs-preview.netlify.app |
# Install all the things | ||
&& apt-get update \ | ||
&& apt-get install -y nodejs gh jq \ | ||
&& apt-get install -y nodejs gh jq build-essential \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
build-essential is the main thing that was missing from slim. It's needed to compile and install various ruby/node native packages.
RUN echo "--- :package: Installing system deps" \ | ||
# Cache apt | ||
rm -f /etc/apt/apt.conf.d/docker-clean \ | ||
&& echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache \ | ||
# Install a few pre-reqs | ||
&& apt-get update \ | ||
&& apt-get install -y curl gnupg \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
curl and gnupg aren't needed in prod, but we do need them in the Dockerfile steps further down
Nice. On a related note I'm still very much thinking about converting the docs into a static site with the intent to eventually remove this image from production. I imagine this image will still kick around for a while and continue being used in CI but not necessarily for serving traffic. |
The slim image comes with far fewer packages pre-installed and we need to manually installed a handful that we need (like curl and build-essential), but in return we get:
The resulting image size difference looks like this:
I think we could probably get it a lot smaller via multistage build, by ensuring tools like nodejs, gh, svn, mercurial, make, gcc, and cpp are used to build assets and native extensions, but not included in the final image. Still, this is a good start.
/cc @danstn