Skip to content

Commit 5837378

Browse files
author
Maik Hummel
committed
Use Nodesource installation routine
1 parent 7497df2 commit 5837378

File tree

1 file changed

+13
-92
lines changed

1 file changed

+13
-92
lines changed

Dockerfile

Lines changed: 13 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -24,95 +24,16 @@ LABEL maintainer="Maik Hummel <[email protected]>" \
2424
org.opencontainers.image.documentation="https://github.com/beevelop/docker-android-nodejs/blob/master/README.md" \
2525
org.opencontainers.image.source="https://github.com/beevelop/docker-android-nodejs.git"
2626

27-
# Source of the following lines (all rights belong to the Node.js contributors)
28-
# https://github.com/nodejs/docker-node/blob/master/14/buster-slim/Dockerfile
29-
# LICENSE: MIT (see https://github.com/nodejs/docker-node/blob/master/LICENSE)
30-
RUN groupadd --gid 1000 node \
31-
&& useradd --uid 1000 --gid node --shell /bin/bash --create-home node
32-
33-
ENV NODE_VERSION 14.15.5
34-
35-
RUN ARCH= && dpkgArch="$(dpkg --print-architecture)" \
36-
&& case "${dpkgArch##*-}" in \
37-
amd64) ARCH='x64';; \
38-
ppc64el) ARCH='ppc64le';; \
39-
s390x) ARCH='s390x';; \
40-
arm64) ARCH='arm64';; \
41-
armhf) ARCH='armv7l';; \
42-
i386) ARCH='x86';; \
43-
*) echo "unsupported architecture"; exit 1 ;; \
44-
esac \
45-
&& set -ex \
46-
# libatomic1 for arm
47-
&& apt-get update && apt-get install -y ca-certificates curl wget gnupg dirmngr xz-utils libatomic1 --no-install-recommends \
48-
&& rm -rf /var/lib/apt/lists/* \
49-
&& for key in \
50-
4ED778F539E3634C779C87C6D7062848A1AB005C \
51-
94AE36675C464D64BAFA68DD7434390BDBE9B9C5 \
52-
74F12602B6F1C4E913FAA37AD3A89613643B6201 \
53-
71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 \
54-
8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600 \
55-
C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 \
56-
C82FA3AE1CBEDC6BE46B9360C43CEC45C17AB93C \
57-
DD8F2338BAE7501E3DD5AC78C273792F7D83545D \
58-
A48C2BEE680E841632CD4E44F07496B3EB3C1762 \
59-
108F52B48DB57BB0CC439B2997B01419BD92F80A \
60-
B9E2F5981AA6E0CD28160D9FF13993A75599653C \
61-
; do \
62-
gpg --batch --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys "$key" || \
63-
gpg --batch --keyserver hkp://ipv4.pool.sks-keyservers.net --recv-keys "$key" || \
64-
gpg --batch --keyserver hkp://pgp.mit.edu:80 --recv-keys "$key" ; \
65-
done \
66-
&& curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-$ARCH.tar.xz" \
67-
&& curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" \
68-
&& gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc \
69-
&& grep " node-v$NODE_VERSION-linux-$ARCH.tar.xz\$" SHASUMS256.txt | sha256sum -c - \
70-
&& tar -xJf "node-v$NODE_VERSION-linux-$ARCH.tar.xz" -C /usr/local --strip-components=1 --no-same-owner \
71-
&& rm "node-v$NODE_VERSION-linux-$ARCH.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt \
72-
&& apt-mark auto '.*' > /dev/null \
73-
&& find /usr/local -type f -executable -exec ldd '{}' ';' \
74-
| awk '/=>/ { print $(NF-1) }' \
75-
| sort -u \
76-
| xargs -r dpkg-query --search \
77-
| cut -d: -f1 \
78-
| sort -u \
79-
| xargs -r apt-mark manual \
80-
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
81-
&& ln -s /usr/local/bin/node /usr/local/bin/nodejs \
82-
# smoke tests
83-
&& node --version \
84-
&& npm --version
85-
86-
ENV YARN_VERSION 1.22.5
87-
88-
RUN set -ex \
89-
&& savedAptMark="$(apt-mark showmanual)" \
90-
&& apt-get update && apt-get install -y ca-certificates curl wget gnupg dirmngr --no-install-recommends \
91-
&& rm -rf /var/lib/apt/lists/* \
92-
&& for key in \
93-
6A010C5166006599AA17F08146C2130DFD2497F5 \
94-
; do \
95-
gpg --batch --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys "$key" || \
96-
gpg --batch --keyserver hkp://ipv4.pool.sks-keyservers.net --recv-keys "$key" || \
97-
gpg --batch --keyserver hkp://pgp.mit.edu:80 --recv-keys "$key" ; \
98-
done \
99-
&& curl -fsSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz" \
100-
&& curl -fsSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz.asc" \
101-
&& gpg --batch --verify yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz \
102-
&& mkdir -p /opt \
103-
&& tar -xzf yarn-v$YARN_VERSION.tar.gz -C /opt/ \
104-
&& ln -s /opt/yarn-v$YARN_VERSION/bin/yarn /usr/local/bin/yarn \
105-
&& ln -s /opt/yarn-v$YARN_VERSION/bin/yarnpkg /usr/local/bin/yarnpkg \
106-
&& rm yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz \
107-
&& apt-mark auto '.*' > /dev/null \
108-
&& { [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark > /dev/null; } \
109-
&& find /usr/local -type f -executable -exec ldd '{}' ';' \
110-
| awk '/=>/ { print $(NF-1) }' \
111-
| sort -u \
112-
| xargs -r dpkg-query --search \
113-
| cut -d: -f1 \
114-
| sort -u \
115-
| xargs -r apt-mark manual \
116-
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
117-
# smoke test
118-
&& yarn --version
27+
RUN apt-get update && apt-get install -y curl gnupg2 lsb-release && \
28+
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - && \
29+
apt-key fingerprint 1655A0AB68576280 && \
30+
export VERSION=node_14.x && \
31+
export DISTRO="$(lsb_release -s -c)" && \
32+
echo "deb https://deb.nodesource.com/$VERSION $DISTRO main" | tee /etc/apt/sources.list.d/nodesource.list && \
33+
echo "deb-src https://deb.nodesource.com/$VERSION $DISTRO main" | tee -a /etc/apt/sources.list.d/nodesource.list && \
34+
apt-get update && apt-get install -y nodejs && \
35+
node -v && npm -v && \
36+
npm install -g yarn && \
37+
yarn -v && \
38+
apt-get clean && \
39+
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

0 commit comments

Comments
 (0)