Last active
July 6, 2019 10:22
-
-
Save 00-matt/ac8609f05bd15dab014bcb37e4b7b468 to your computer and use it in GitHub Desktop.
Docker Images for Node.js and Yarn - https://hub.docker.com/r/offtopica/nodejs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM debian:buster AS builder | |
ENV NODE_VERSION 10.16.0 | |
ENV YARN_VERSION 1.16.0 | |
COPY KEYS.* /tmp/ | |
WORKDIR /root | |
RUN set -ex; \ | |
apt-get update; \ | |
apt-get install -y --no-install-recommends \ | |
ca-certificates \ | |
curl \ | |
g++ \ | |
gnupg \ | |
make \ | |
python; \ | |
rm -rf /var/lib/apt/lists/*; \ | |
gpg --batch --import /tmp/KEYS.*; \ | |
curl -fsSLO --compressed "https://github.com/yarnpkg/yarn/releases/download/v${YARN_VERSION}/yarn-v${YARN_VERSION}.tar.gz"; \ | |
curl -fsSLO --compressed "https://github.com/yarnpkg/yarn/releases/download/v${YARN_VERSION}/yarn-v${YARN_VERSION}.tar.gz.asc"; \ | |
gpg --verify yarn-v${YARN_VERSION}.tar.gz.asc; \ | |
mkdir -p /usr/local/share/yarn/; \ | |
tar xf yarn-v${YARN_VERSION}.tar.gz -C /usr/local/share/yarn/ --strip 1; \ | |
curl -fsSLO --compressed "https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}.tar.gz"; \ | |
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}.tar.gz\$" SHASUMS256.txt | sha256sum -c -; \ | |
tar xf node-v${NODE_VERSION}.tar.gz; \ | |
cd node-v${NODE_VERSION}; \ | |
./configure \ | |
--partly-static \ | |
--without-dtrace \ | |
--without-etw \ | |
--without-npm \ | |
--without-inspector; \ | |
make -j$(nproc); \ | |
make install | |
FROM debian:buster | |
COPY --from=builder /usr/local/bin/node /usr/local/bin/node | |
COPY --from=builder /usr/local/include/node /usr/local/include/node | |
COPY --from=builder /usr/local/share/yarn /usr/local/share/yarn | |
RUN set -ex; \ | |
ln -s /usr/local/share/yarn/bin/yarn /usr/local/bin/yarn; \ | |
ln -s /usr/local/share/yarn/bin/yarn /usr/local/bin/yarnpkg; \ | |
groupadd --gid 1000 nodejs; \ | |
useradd --uid 1000 --gid nodejs --shell /bin/bash --create-home nodejs | |
USER nodejs | |
ENTRYPOINT ["/usr/local/bin/node"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -ex | |
KEYSERVER="http://ha.pool.sks-keyservers.net/pks" | |
NODE_KEYS="\ | |
4ED778F539E3634C779C87C6D7062848A1AB005C | |
B9E2F5981AA6E0CD28160D9FF13993A75599653C | |
94AE36675C464D64BAFA68DD7434390BDBE9B9C5 | |
B9AE9905FFD7803F25714661B63B535A4C206CA9 | |
77984A986EBC2AA786BC0F66B01FBB92821C587A | |
71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 | |
FD3A5288F042B6850C66B31F09FE44734EB7990E | |
8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600 | |
C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 | |
DD8F2338BAE7501E3DD5AC78C273792F7D83545D | |
A48C2BEE680E841632CD4E44F07496B3EB3C1762" | |
YARN_KEYS="\ | |
72ECF46A56B4AD39C907BBB71646B01B86E50310" | |
for fingerprint in $NODE_KEYS; do | |
curl --silent \ | |
--max-time 10 \ | |
"${KEYSERVER}/lookup?search=0x${fingerprint}&options=mr&op=get" \ | |
>> NODE.keys | |
done | |
for fingerprint in $YARN_KEYS; do | |
curl --silent \ | |
--max-time 10 \ | |
"${KEYSERVER}/lookup?search=0x${fingerprint}&options=mr&op=get" \ | |
>> YARN.keys | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment