Hi!
The slim image variants (for example: node:9.4.0-slim) currently use buildpack-deps:jessie-curl as the image base (which is 72MB).
I was wondering if there was a reason why debian:jessie-slim or debian:stretch-slim (which are 30MB and 22MB respectively) aren't used instead? As a datapoint the official Python images recently made a similar switch (docker-library/python#233).
If this is something people would be open to, I'm happy to create a PR :-)
It's mostly because we use curl to download the Node.js and yarn binaries.
Thank you for the reply :-)
The slim debian image variants differ in more than just curl - they also exclude a number of superfluous files:
https://github.com/debuerreotype/debuerreotype/blob/master/scripts/.slimify-excludes
As such manually installing curl into the debian:*-slim images would still have a net size win - plus curl could always be treated as a build-time only dependency and uninstalled afterwards (like other official images do).
That seems pretty compelling, especially the file-size reduction. If we do switch to debian:jessie-slim we might want to keep curl installed just to avoid any breakage for users who expect it to be in the slim image. I don't really see that as a dealbreaker though.
I looked into this a little bit more. The jessie-curl also includes wget, so dropping that would break the ghost image: https://github.com/docker-library/ghost/blob/master/1/debian/Dockerfile#L8
The ghost image would love to adapt to such a change, but I can't speak for
any other image maintainers. 馃槆
Would having jessie-slim plus curl and wget be enough of a size saving to justify the change?
It didn鈥檛 really seem like it when I tried it, but I don鈥檛 recall what the size difference was.
I think maybe we just err on the side of making the image smaller (with curl and the ca certs installed as buildDeps) and try to notify anyone downstream if we can. The ghost image is the only one I'm aware of, so we're covered there I guess :)
Just did a test of node:10-slim, and the results are pretty compelling IMO:
diff --git a/10/slim/Dockerfile b/10/slim/Dockerfile
index ccd8ece..db9ca55 100644
--- a/10/slim/Dockerfile
+++ b/10/slim/Dockerfile
@@ -1,4 +1,6 @@
-FROM buildpack-deps:jessie-curl
+FROM debian:jessie-slim
+
+RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates curl wget && rm -rf /var/lib/apt/lists/*
RUN groupadd --gid 1000 node \
&& useradd --uid 1000 --gid node --shell /bin/bash --create-home node
Before: ~233MB
After: ~185MB
Nice!
150MB if we put ca-certificates and curl in buildDeps.
I'm going to do a PR for switching to jessie-slim with curl and wget installed. The savings are pretty decent.
Most helpful comment
That seems pretty compelling, especially the file-size reduction. If we do switch to
debian:jessie-slimwe might want to keepcurlinstalled just to avoid any breakage for users who expect it to be in the slim image. I don't really see that as a dealbreaker though.