From 181c14e55927b5eb3fc40c0a59af60eee8402734 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Wed, 21 Jan 2015 11:32:34 -0700 Subject: [PATCH] Slimmer slim variants and a few consistency fixes This removes almost all of the dependencies from the slim variant. The rationale for this is that the slim variants are intentionally supposed to be for people who really know what they're doing and want to create an image that's as small as is reasonably possible for their very specific use case (meaning that if they want to be able to, for example, `npm install` native modules, they'll need to know which packages that requires), where the normal variant is supposed to be as generic as possible for the majority of use cases (hence why it is `FROM buildpack-deps` -- see https://registry.hub.docker.com/_/buildpack-deps/ for more information about that and what's included there). This also updates `FROM buildpack-deps` to be the more explicit (but currently equivalent) `FROM buildpack-deps:jessie`, and updated the slim variants to use `debian:jessie` instead of `debian:wheezy` so that they all have the same base underneath. ```console $ docker images node REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE node 0.8-slim 3c0b9c2ee34f 4 hours ago 286.3 MB node 0.8 45c9764d3191 4 hours ago 704.1 MB node 0.11-slim 869731dd5c7f 4 hours ago 296.2 MB node 0.11 c26e7af3ade7 4 hours ago 714 MB node 0.10-slim af6b79e3e7dd 4 hours ago 287.3 MB node 0.10 9787c55efe92 4 hours ago 705 MB $ ./generate-stackbrew-library.sh | sed 's!joyent/docker-node!infosiftr/node!' > node $ bashbrew build ./node Fetching node (git://github.com/infosiftr/node) ... Processing node:0.10.35 ... ... Processing node:0.8-slim ... $ docker images node REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE node 0.8-slim ef20a87f7564 39 seconds ago 149.3 MB node 0.8 a62c349fcfbd 2 minutes ago 694.6 MB node 0.11-slim 9cf495665fa1 3 minutes ago 159.2 MB node 0.11 9671c6b7befe 6 minutes ago 704.5 MB node 0.10-slim eda61ceff5e2 7 minutes ago 150.3 MB node 0.10 2895ad48803c 10 minutes ago 695.6 MB ``` --- 0.10/Dockerfile | 6 +----- 0.10/slim/Dockerfile | 18 +++++++----------- 0.11/Dockerfile | 6 +----- 0.11/slim/Dockerfile | 18 +++++++----------- 0.8/Dockerfile | 6 +----- 0.8/slim/Dockerfile | 18 +++++++----------- 6 files changed, 24 insertions(+), 48 deletions(-) diff --git a/0.10/Dockerfile b/0.10/Dockerfile index 8a7982b93..42b59820d 100644 --- a/0.10/Dockerfile +++ b/0.10/Dockerfile @@ -1,8 +1,4 @@ -FROM buildpack-deps - -RUN apt-get update && apt-get install -y \ - ca-certificates \ - curl +FROM buildpack-deps:jessie # verify gpg and sha256: http://nodejs.org/dist/v0.10.31/SHASUMS256.txt.asc # gpg: aka "Timothy J Fontaine (Work) " diff --git a/0.10/slim/Dockerfile b/0.10/slim/Dockerfile index d9cc5e942..27c7ec13b 100644 --- a/0.10/slim/Dockerfile +++ b/0.10/slim/Dockerfile @@ -1,13 +1,4 @@ -FROM debian:wheezy - -RUN apt-get update && apt-get install -y --no-install-recommends \ - ca-certificates \ - curl \ - build-essential \ - pkg-config \ - git \ - python \ - && rm -rf /var/lib/apt/lists/* +FROM debian:jessie # verify gpg and sha256: http://nodejs.org/dist/v0.10.31/SHASUMS256.txt.asc # gpg: aka "Timothy J Fontaine (Work) " @@ -17,12 +8,17 @@ RUN gpg --keyserver pool.sks-keyservers.net --recv-keys 7937DFD2AB06298B2293C318 ENV NODE_VERSION 0.10.35 ENV NPM_VERSION 2.2.0 -RUN curl -SLO "http://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.gz" \ +RUN buildDeps='curl' \ + && set -x \ + && apt-get update && apt-get install -y $buildDeps --no-install-recommends \ + && rm -rf /var/lib/apt/lists/* \ + && curl -SLO "http://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.gz" \ && curl -SLO "http://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" \ && gpg --verify SHASUMS256.txt.asc \ && grep " node-v$NODE_VERSION-linux-x64.tar.gz\$" SHASUMS256.txt.asc | sha256sum -c - \ && tar -xzf "node-v$NODE_VERSION-linux-x64.tar.gz" -C /usr/local --strip-components=1 \ && rm "node-v$NODE_VERSION-linux-x64.tar.gz" SHASUMS256.txt.asc \ + && apt-get purge -y --auto-remove $buildDeps \ && npm install -g npm@"$NPM_VERSION" \ && npm cache clear diff --git a/0.11/Dockerfile b/0.11/Dockerfile index 7b859e4fa..c09ad7d0c 100644 --- a/0.11/Dockerfile +++ b/0.11/Dockerfile @@ -1,8 +1,4 @@ -FROM buildpack-deps - -RUN apt-get update && apt-get install -y \ - ca-certificates \ - curl +FROM buildpack-deps:jessie # verify gpg and sha256: http://nodejs.org/dist/v0.10.30/SHASUMS256.txt.asc # gpg: aka "Timothy J Fontaine (Work) " diff --git a/0.11/slim/Dockerfile b/0.11/slim/Dockerfile index 0548da056..6006f1e58 100644 --- a/0.11/slim/Dockerfile +++ b/0.11/slim/Dockerfile @@ -1,13 +1,4 @@ -FROM debian:wheezy - -RUN apt-get update && apt-get install -y --no-install-recommends \ - ca-certificates \ - curl \ - build-essential \ - pkg-config \ - git \ - python \ - && rm -rf /var/lib/apt/lists/* +FROM debian:jessie # verify gpg and sha256: http://nodejs.org/dist/v0.10.30/SHASUMS256.txt.asc # gpg: aka "Timothy J Fontaine (Work) " @@ -17,12 +8,17 @@ RUN gpg --keyserver pool.sks-keyservers.net --recv-keys 7937DFD2AB06298B2293C318 ENV NODE_VERSION 0.11.15 ENV NPM_VERSION 2.2.0 -RUN curl -SLO "http://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.gz" \ +RUN buildDeps='curl' \ + && set -x \ + && apt-get update && apt-get install -y $buildDeps --no-install-recommends \ + && rm -rf /var/lib/apt/lists/* \ + && curl -SLO "http://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.gz" \ && curl -SLO "http://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" \ && gpg --verify SHASUMS256.txt.asc \ && grep " node-v$NODE_VERSION-linux-x64.tar.gz\$" SHASUMS256.txt.asc | sha256sum -c - \ && tar -xzf "node-v$NODE_VERSION-linux-x64.tar.gz" -C /usr/local --strip-components=1 \ && rm "node-v$NODE_VERSION-linux-x64.tar.gz" SHASUMS256.txt.asc \ + && apt-get purge -y --auto-remove $buildDeps \ && npm install -g npm@"$NPM_VERSION" \ && npm cache clear diff --git a/0.8/Dockerfile b/0.8/Dockerfile index 317c4c929..0a947a526 100644 --- a/0.8/Dockerfile +++ b/0.8/Dockerfile @@ -1,8 +1,4 @@ -FROM buildpack-deps - -RUN apt-get update && apt-get install -y \ - ca-certificates \ - curl +FROM buildpack-deps:jessie # verify gpg and sha256: http://nodejs.org/dist/v0.10.30/SHASUMS256.txt.asc # gpg: aka "Timothy J Fontaine (Work) " diff --git a/0.8/slim/Dockerfile b/0.8/slim/Dockerfile index 48a91c410..917833690 100644 --- a/0.8/slim/Dockerfile +++ b/0.8/slim/Dockerfile @@ -1,13 +1,4 @@ -FROM debian:wheezy - -RUN apt-get update && apt-get install -y --no-install-recommends \ - ca-certificates \ - curl \ - build-essential \ - pkg-config \ - git \ - python \ - && rm -rf /var/lib/apt/lists/* +FROM debian:jessie # verify gpg and sha256: http://nodejs.org/dist/v0.10.30/SHASUMS256.txt.asc # gpg: aka "Timothy J Fontaine (Work) " @@ -17,12 +8,17 @@ RUN gpg --keyserver pool.sks-keyservers.net --recv-keys 7937DFD2AB06298B2293C318 ENV NODE_VERSION 0.8.28 ENV NPM_VERSION 2.2.0 -RUN curl -SLO "http://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.gz" \ +RUN buildDeps='curl' \ + && set -x \ + && apt-get update && apt-get install -y $buildDeps --no-install-recommends \ + && rm -rf /var/lib/apt/lists/* \ + && curl -SLO "http://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.gz" \ && curl -SLO "http://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" \ && gpg --verify SHASUMS256.txt.asc \ && grep " node-v$NODE_VERSION-linux-x64.tar.gz\$" SHASUMS256.txt.asc | sha256sum -c - \ && tar -xzf "node-v$NODE_VERSION-linux-x64.tar.gz" -C /usr/local --strip-components=1 \ && rm "node-v$NODE_VERSION-linux-x64.tar.gz" SHASUMS256.txt.asc \ + && apt-get purge -y --auto-remove $buildDeps \ && npm install -g npm@1.4.28 \ && npm install -g npm@"$NPM_VERSION" \ && npm cache clear