From 7fa68ae5e93bed386f2f5b509664a58bd86f9741 Mon Sep 17 00:00:00 2001 From: Christopher Horrell Date: Tue, 29 May 2018 21:35:33 -0400 Subject: [PATCH] Add Node.js "core" image This is an image without npm or yarn installed, suitable for multi-stage builds. Closes #404 --- .travis.yml | 20 ++++++++++++++++ 10/core/Dockerfile | 51 ++++++++++++++++++++++++++++++++++++++++ 6/architectures | 12 +++++----- 6/core/Dockerfile | 51 ++++++++++++++++++++++++++++++++++++++++ 8/core/Dockerfile | 51 ++++++++++++++++++++++++++++++++++++++++ 9/core/Dockerfile | 51 ++++++++++++++++++++++++++++++++++++++++ Dockerfile-core.template | 44 ++++++++++++++++++++++++++++++++++ architectures | 12 +++++----- 8 files changed, 280 insertions(+), 12 deletions(-) create mode 100644 10/core/Dockerfile create mode 100644 6/core/Dockerfile create mode 100644 8/core/Dockerfile create mode 100644 9/core/Dockerfile create mode 100644 Dockerfile-core.template diff --git a/.travis.yml b/.travis.yml index 7d9cd77f0..309ff0423 100644 --- a/.travis.yml +++ b/.travis.yml @@ -104,6 +104,11 @@ jobs: - NODE_VERSION: "10" - VARIANT: "stretch" + - stage: Build + env: + - NODE_VERSION: "10" + - VARIANT: "core" + - stage: Build env: - NODE_VERSION: "6" @@ -129,6 +134,11 @@ jobs: - NODE_VERSION: "6" - VARIANT: "stretch" + - stage: Build + env: + - NODE_VERSION: "6" + - VARIANT: "core" + - stage: Build env: - NODE_VERSION: "8" @@ -154,6 +164,11 @@ jobs: - NODE_VERSION: "8" - VARIANT: "stretch" + - stage: Build + env: + - NODE_VERSION: "8" + - VARIANT: "core" + - stage: Build env: - NODE_VERSION: "9" @@ -179,6 +194,11 @@ jobs: - NODE_VERSION: "9" - VARIANT: "stretch" + - stage: Build + env: + - NODE_VERSION: "9" + - VARIANT: "core" + - stage: Build env: - NODE_VERSION: "chakracore/10" diff --git a/10/core/Dockerfile b/10/core/Dockerfile new file mode 100644 index 000000000..a0e581568 --- /dev/null +++ b/10/core/Dockerfile @@ -0,0 +1,51 @@ +FROM debian:jessie-slim + +RUN groupadd --gid 1000 node \ + && useradd --uid 1000 --gid node --shell /bin/bash --create-home node + +# gpg keys listed at https://github.com/nodejs/node#release-team +RUN set -ex \ + && for key in \ + 94AE36675C464D64BAFA68DD7434390BDBE9B9C5 \ + FD3A5288F042B6850C66B31F09FE44734EB7990E \ + 71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 \ + DD8F2338BAE7501E3DD5AC78C273792F7D83545D \ + C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 \ + B9AE9905FFD7803F25714661B63B535A4C206CA9 \ + 56730D5401028683275BD23C23EFEFE93C4CFFFE \ + 77984A986EBC2AA786BC0F66B01FBB92821C587A \ + ; do \ + gpg --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys "$key" || \ + gpg --keyserver hkp://ipv4.pool.sks-keyservers.net --recv-keys "$key" || \ + gpg --keyserver hkp://pgp.mit.edu:80 --recv-keys "$key" ; \ + done + +ENV NODE_VERSION 10.3.0 + +RUN buildDeps='ca-certificates curl xz-utils' \ + ARCH= && dpkgArch="$(dpkg --print-architecture)" \ + && case "${dpkgArch##*-}" in \ + amd64) ARCH='x64';; \ + ppc64el) ARCH='ppc64le';; \ + s390x) ARCH='s390x';; \ + arm64) ARCH='arm64';; \ + armhf) ARCH='armv7l';; \ + i386) ARCH='x86';; \ + *) echo "unsupported architecture"; exit 1 ;; \ + esac \ + && set -x \ + && apt-get update && apt-get install -y $buildDeps --no-install-recommends \ + && rm -rf /var/lib/apt/lists/* \ + && curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-$ARCH.tar.xz" \ + && curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" \ + && gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc \ + && grep " node-v$NODE_VERSION-linux-$ARCH.tar.xz\$" SHASUMS256.txt | sha256sum -c - \ + && tar -xJf "node-v$NODE_VERSION-linux-$ARCH.tar.xz" -C /usr/local --strip-components=1 --no-same-owner \ + && rm -rf /usr/local/lib/node_modules/ \ + && rm -rf /usr/local/bin/npm \ + && rm -rf /usr/local/bin/npx \ + && rm "node-v$NODE_VERSION-linux-$ARCH.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt \ + && apt-get purge -y --auto-remove $buildDeps \ + && ln -s /usr/local/bin/node /usr/local/bin/nodejs + +CMD [ "node" ] diff --git a/6/architectures b/6/architectures index f6a742740..51d7f6626 100644 --- a/6/architectures +++ b/6/architectures @@ -1,7 +1,7 @@ bashbrew-arch variants -arm32v7 jessie,onbuild,slim,stretch -arm64v8 jessie,onbuild,slim,stretch -amd64 jessie,alpine,onbuild,slim,stretch -i386 jessie,onbuild,slim,stretch -ppc64le jessie,onbuild,slim,stretch -s390x jessie,onbuild,slim,stretch +arm32v7 jessie,onbuild,slim,stretch,core +arm64v8 jessie,onbuild,slim,stretch,core +amd64 jessie,alpine,onbuild,slim,stretch,core +i386 jessie,onbuild,slim,stretch,core +ppc64le jessie,onbuild,slim,stretch,core +s390x jessie,onbuild,slim,stretch,core diff --git a/6/core/Dockerfile b/6/core/Dockerfile new file mode 100644 index 000000000..56e6020d5 --- /dev/null +++ b/6/core/Dockerfile @@ -0,0 +1,51 @@ +FROM debian:jessie-slim + +RUN groupadd --gid 1000 node \ + && useradd --uid 1000 --gid node --shell /bin/bash --create-home node + +# gpg keys listed at https://github.com/nodejs/node#release-team +RUN set -ex \ + && for key in \ + 94AE36675C464D64BAFA68DD7434390BDBE9B9C5 \ + FD3A5288F042B6850C66B31F09FE44734EB7990E \ + 71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 \ + DD8F2338BAE7501E3DD5AC78C273792F7D83545D \ + C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 \ + B9AE9905FFD7803F25714661B63B535A4C206CA9 \ + 56730D5401028683275BD23C23EFEFE93C4CFFFE \ + 77984A986EBC2AA786BC0F66B01FBB92821C587A \ + ; do \ + gpg --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys "$key" || \ + gpg --keyserver hkp://ipv4.pool.sks-keyservers.net --recv-keys "$key" || \ + gpg --keyserver hkp://pgp.mit.edu:80 --recv-keys "$key" ; \ + done + +ENV NODE_VERSION 6.14.2 + +RUN buildDeps='ca-certificates curl xz-utils' \ + ARCH= && dpkgArch="$(dpkg --print-architecture)" \ + && case "${dpkgArch##*-}" in \ + amd64) ARCH='x64';; \ + ppc64el) ARCH='ppc64le';; \ + s390x) ARCH='s390x';; \ + arm64) ARCH='arm64';; \ + armhf) ARCH='armv7l';; \ + i386) ARCH='x86';; \ + *) echo "unsupported architecture"; exit 1 ;; \ + esac \ + && set -x \ + && apt-get update && apt-get install -y $buildDeps --no-install-recommends \ + && rm -rf /var/lib/apt/lists/* \ + && curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-$ARCH.tar.xz" \ + && curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" \ + && gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc \ + && grep " node-v$NODE_VERSION-linux-$ARCH.tar.xz\$" SHASUMS256.txt | sha256sum -c - \ + && tar -xJf "node-v$NODE_VERSION-linux-$ARCH.tar.xz" -C /usr/local --strip-components=1 --no-same-owner \ + && rm -rf /usr/local/lib/node_modules/ \ + && rm -rf /usr/local/bin/npm \ + && rm -rf /usr/local/bin/npx \ + && rm "node-v$NODE_VERSION-linux-$ARCH.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt \ + && apt-get purge -y --auto-remove $buildDeps \ + && ln -s /usr/local/bin/node /usr/local/bin/nodejs + +CMD [ "node" ] diff --git a/8/core/Dockerfile b/8/core/Dockerfile new file mode 100644 index 000000000..23a6b403d --- /dev/null +++ b/8/core/Dockerfile @@ -0,0 +1,51 @@ +FROM debian:jessie-slim + +RUN groupadd --gid 1000 node \ + && useradd --uid 1000 --gid node --shell /bin/bash --create-home node + +# gpg keys listed at https://github.com/nodejs/node#release-team +RUN set -ex \ + && for key in \ + 94AE36675C464D64BAFA68DD7434390BDBE9B9C5 \ + FD3A5288F042B6850C66B31F09FE44734EB7990E \ + 71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 \ + DD8F2338BAE7501E3DD5AC78C273792F7D83545D \ + C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 \ + B9AE9905FFD7803F25714661B63B535A4C206CA9 \ + 56730D5401028683275BD23C23EFEFE93C4CFFFE \ + 77984A986EBC2AA786BC0F66B01FBB92821C587A \ + ; do \ + gpg --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys "$key" || \ + gpg --keyserver hkp://ipv4.pool.sks-keyservers.net --recv-keys "$key" || \ + gpg --keyserver hkp://pgp.mit.edu:80 --recv-keys "$key" ; \ + done + +ENV NODE_VERSION 8.11.2 + +RUN buildDeps='ca-certificates curl xz-utils' \ + ARCH= && dpkgArch="$(dpkg --print-architecture)" \ + && case "${dpkgArch##*-}" in \ + amd64) ARCH='x64';; \ + ppc64el) ARCH='ppc64le';; \ + s390x) ARCH='s390x';; \ + arm64) ARCH='arm64';; \ + armhf) ARCH='armv7l';; \ + i386) ARCH='x86';; \ + *) echo "unsupported architecture"; exit 1 ;; \ + esac \ + && set -x \ + && apt-get update && apt-get install -y $buildDeps --no-install-recommends \ + && rm -rf /var/lib/apt/lists/* \ + && curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-$ARCH.tar.xz" \ + && curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" \ + && gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc \ + && grep " node-v$NODE_VERSION-linux-$ARCH.tar.xz\$" SHASUMS256.txt | sha256sum -c - \ + && tar -xJf "node-v$NODE_VERSION-linux-$ARCH.tar.xz" -C /usr/local --strip-components=1 --no-same-owner \ + && rm -rf /usr/local/lib/node_modules/ \ + && rm -rf /usr/local/bin/npm \ + && rm -rf /usr/local/bin/npx \ + && rm "node-v$NODE_VERSION-linux-$ARCH.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt \ + && apt-get purge -y --auto-remove $buildDeps \ + && ln -s /usr/local/bin/node /usr/local/bin/nodejs + +CMD [ "node" ] diff --git a/9/core/Dockerfile b/9/core/Dockerfile new file mode 100644 index 000000000..e7cfc211d --- /dev/null +++ b/9/core/Dockerfile @@ -0,0 +1,51 @@ +FROM debian:jessie-slim + +RUN groupadd --gid 1000 node \ + && useradd --uid 1000 --gid node --shell /bin/bash --create-home node + +# gpg keys listed at https://github.com/nodejs/node#release-team +RUN set -ex \ + && for key in \ + 94AE36675C464D64BAFA68DD7434390BDBE9B9C5 \ + FD3A5288F042B6850C66B31F09FE44734EB7990E \ + 71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 \ + DD8F2338BAE7501E3DD5AC78C273792F7D83545D \ + C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 \ + B9AE9905FFD7803F25714661B63B535A4C206CA9 \ + 56730D5401028683275BD23C23EFEFE93C4CFFFE \ + 77984A986EBC2AA786BC0F66B01FBB92821C587A \ + ; do \ + gpg --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys "$key" || \ + gpg --keyserver hkp://ipv4.pool.sks-keyservers.net --recv-keys "$key" || \ + gpg --keyserver hkp://pgp.mit.edu:80 --recv-keys "$key" ; \ + done + +ENV NODE_VERSION 9.11.1 + +RUN buildDeps='ca-certificates curl xz-utils' \ + ARCH= && dpkgArch="$(dpkg --print-architecture)" \ + && case "${dpkgArch##*-}" in \ + amd64) ARCH='x64';; \ + ppc64el) ARCH='ppc64le';; \ + s390x) ARCH='s390x';; \ + arm64) ARCH='arm64';; \ + armhf) ARCH='armv7l';; \ + i386) ARCH='x86';; \ + *) echo "unsupported architecture"; exit 1 ;; \ + esac \ + && set -x \ + && apt-get update && apt-get install -y $buildDeps --no-install-recommends \ + && rm -rf /var/lib/apt/lists/* \ + && curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-$ARCH.tar.xz" \ + && curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" \ + && gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc \ + && grep " node-v$NODE_VERSION-linux-$ARCH.tar.xz\$" SHASUMS256.txt | sha256sum -c - \ + && tar -xJf "node-v$NODE_VERSION-linux-$ARCH.tar.xz" -C /usr/local --strip-components=1 --no-same-owner \ + && rm -rf /usr/local/lib/node_modules/ \ + && rm -rf /usr/local/bin/npm \ + && rm -rf /usr/local/bin/npx \ + && rm "node-v$NODE_VERSION-linux-$ARCH.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt \ + && apt-get purge -y --auto-remove $buildDeps \ + && ln -s /usr/local/bin/node /usr/local/bin/nodejs + +CMD [ "node" ] diff --git a/Dockerfile-core.template b/Dockerfile-core.template new file mode 100644 index 000000000..ef010c0a8 --- /dev/null +++ b/Dockerfile-core.template @@ -0,0 +1,44 @@ +FROM debian:jessie-slim + +RUN groupadd --gid 1000 node \ + && useradd --uid 1000 --gid node --shell /bin/bash --create-home node + +# gpg keys listed at https://github.com/nodejs/node#release-team +RUN set -ex \ + && for key in \ + "${NODE_KEYS[@]}" + ; do \ + gpg --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys "$key" || \ + gpg --keyserver hkp://ipv4.pool.sks-keyservers.net --recv-keys "$key" || \ + gpg --keyserver hkp://pgp.mit.edu:80 --recv-keys "$key" ; \ + done + +ENV NODE_VERSION 0.0.0 + +RUN buildDeps='ca-certificates curl xz-utils' \ + ARCH= && dpkgArch="$(dpkg --print-architecture)" \ + && case "${dpkgArch##*-}" in \ + amd64) ARCH='x64';; \ + ppc64el) ARCH='ppc64le';; \ + s390x) ARCH='s390x';; \ + arm64) ARCH='arm64';; \ + armhf) ARCH='armv7l';; \ + i386) ARCH='x86';; \ + *) echo "unsupported architecture"; exit 1 ;; \ + esac \ + && set -x \ + && apt-get update && apt-get install -y $buildDeps --no-install-recommends \ + && rm -rf /var/lib/apt/lists/* \ + && curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-$ARCH.tar.xz" \ + && curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" \ + && gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc \ + && grep " node-v$NODE_VERSION-linux-$ARCH.tar.xz\$" SHASUMS256.txt | sha256sum -c - \ + && tar -xJf "node-v$NODE_VERSION-linux-$ARCH.tar.xz" -C /usr/local --strip-components=1 --no-same-owner \ + && rm -rf /usr/local/lib/node_modules/ \ + && rm -rf /usr/local/bin/npm \ + && rm -rf /usr/local/bin/npx \ + && rm "node-v$NODE_VERSION-linux-$ARCH.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt \ + && apt-get purge -y --auto-remove $buildDeps \ + && ln -s /usr/local/bin/node /usr/local/bin/nodejs + +CMD [ "node" ] diff --git a/architectures b/architectures index 1a9b7a2dd..fad08eea9 100644 --- a/architectures +++ b/architectures @@ -1,8 +1,8 @@ bashbrew-arch variants arm32v6 alpine -arm32v7 jessie,onbuild,slim,stretch -arm64v8 jessie,alpine,onbuild,slim,stretch -amd64 jessie,alpine,onbuild,slim,stretch -i386 jessie,alpine,onbuild,slim,stretch -ppc64le jessie,alpine,onbuild,slim,stretch -s390x jessie,alpine,onbuild,slim,stretch +arm32v7 jessie,onbuild,slim,stretch,core +arm64v8 jessie,alpine,onbuild,slim,stretch,core +amd64 jessie,alpine,onbuild,slim,stretch,core +i386 jessie,alpine,onbuild,slim,stretch,core +ppc64le jessie,alpine,onbuild,slim,stretch,core +s390x jessie,alpine,onbuild,slim,stretch,core