Skip to content

Commit b6a2194

Browse files
authored
Ensures the mjml is install correctly on the core image (Netflix#923)
1 parent 64c3ada commit b6a2194

File tree

2 files changed

+11
-66
lines changed

2 files changed

+11
-66
lines changed

.dockerignore

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ package.json
2424
/build
2525
/env
2626
/tmp
27-
/node_modules/
27+
node_modules
2828
/wheelhouse
2929
/test_cli/
3030
.idea/
@@ -34,4 +34,4 @@ package.json
3434
coverage.xml
3535
junit.xml
3636
*.codestyle.xml
37-
package-lock.json
37+
package-lock.json

docker/Dockerfile

+9-64
Original file line numberDiff line numberDiff line change
@@ -8,73 +8,16 @@ LABEL org.opencontainers.image.source="https://github.com/netflix/dispatch"
88
LABEL org.opencontainers.image.vendor="Netflix, Inc."
99
LABEL org.opencontainers.image.authors="[email protected]"
1010

11+
# Get and set up Node for front-end asset building
1112
RUN apt-get update && apt-get install -y --no-install-recommends \
12-
# Needed for GPG
13-
dirmngr \
14-
gnupg2 \
1513
# Needed for fetching stuff
1614
ca-certificates \
1715
wget \
1816
&& rm -rf /var/lib/apt/lists/*
1917

20-
# Fetch trusted keys
21-
RUN for key in \
22-
# gosu
23-
B42F6819007F00F88E364FD4036A9C25BF357DD4 \
24-
# tini
25-
595E85A6B1B4779EA4DAAEC70B588DFF0527A9B7 \
26-
# Node - gpg keys listed at https://github.com/nodejs/node
27-
94AE36675C464D64BAFA68DD7434390BDBE9B9C5 \
28-
FD3A5288F042B6850C66B31F09FE44734EB7990E \
29-
71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 \
30-
DD8F2338BAE7501E3DD5AC78C273792F7D83545D \
31-
C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 \
32-
B9AE9905FFD7803F25714661B63B535A4C206CA9 \
33-
77984A986EBC2AA786BC0F66B01FBB92821C587A \
34-
8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600 \
35-
4ED778F539E3634C779C87C6D7062848A1AB005C \
36-
A48C2BEE680E841632CD4E44F07496B3EB3C1762 \
37-
B9E2F5981AA6E0CD28160D9FF13993A75599653C \
38-
; do \
39-
# Let's try several servers to ensure we get all the keys
40-
for server in \
41-
keys.openpgp.org \
42-
keyserver.ubuntu.com \
43-
hkps.pool.sks-keyservers.net \
44-
; do \
45-
gpg2 --batch --keyserver "$server" --recv-keys "$key"; \
46-
done \
47-
done
48-
49-
# grab gosu for easy step-down from root
50-
ENV GOSU_VERSION 1.12
51-
RUN set -x \
52-
&& dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')" \
53-
&& wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch" \
54-
&& wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc" \
55-
&& gpg2 --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \
56-
&& rm -f /usr/local/bin/gosu.asc \
57-
&& chmod +x /usr/local/bin/gosu
58-
59-
# grab tini for signal processing and zombie killing
60-
ENV TINI_VERSION 0.18.0
6118
RUN set -x \
62-
&& wget -O /usr/local/bin/tini "https://github.com/krallin/tini/releases/download/v$TINI_VERSION/tini" \
63-
&& wget -O /usr/local/bin/tini.asc "https://github.com/krallin/tini/releases/download/v$TINI_VERSION/tini.asc" \
64-
&& gpg --batch --verify /usr/local/bin/tini.asc /usr/local/bin/tini \
65-
&& rm -f /usr/local/bin/tini.asc \
66-
&& chmod +x /usr/local/bin/tini
67-
68-
# Get and set up Node for front-end asset building
69-
COPY .nvmrc /usr/src/dispatch/
70-
RUN cd /usr/src/dispatch \
71-
&& export NODE_VERSION="$(cat .nvmrc)" \
72-
&& wget "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.gz" \
73-
&& wget "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" \
74-
&& gpg --batch --verify SHASUMS256.txt.asc \
75-
&& grep " node-v$NODE_VERSION-linux-x64.tar.gz\$" SHASUMS256.txt.asc | sha256sum -c - \
76-
&& tar -xzf "node-v$NODE_VERSION-linux-x64.tar.gz" -C /usr/local --strip-components=1 \
77-
&& rm -f "node-v$NODE_VERSION-linux-x64.tar.gz" SHASUMS256.txt.asc
19+
&& wget --quiet -O - https://deb.nodesource.com/setup_12.x | bash - \
20+
&& apt-get install -y nodejs
7821

7922
ARG SOURCE_COMMIT
8023
ENV DISPATCH_BUILD=${SOURCE_COMMIT:-unknown}
@@ -109,8 +52,6 @@ LABEL org.opencontainers.image.authors="[email protected]"
10952
# add our user and group first to make sure their IDs get assigned consistently
11053
RUN groupadd -r dispatch && useradd -r -m -g dispatch dispatch
11154

112-
COPY --from=sdist /usr/local/bin/gosu /usr/local/bin/tini /usr/local/bin/node /usr/local/bin/
113-
11455
# Sane defaults for pip
11556
ENV PIP_NO_CACHE_DIR=off \
11657
PIP_DISABLE_PIP_VERSION_CHECK=1 \
@@ -121,6 +62,9 @@ RUN set -x \
12162
&& echo "deb http://apt.postgresql.org/pub/repos/apt buster-pgdg main" > /etc/apt/sources.list.d/pgdg.list \
12263
&& wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
12364

65+
RUN set -x \
66+
&& wget --quiet -O - https://deb.nodesource.com/setup_12.x | bash -
67+
12468
COPY --from=sdist /dist/*.whl /tmp/dist/
12569
RUN set -x \
12670
&& buildDeps="" \
@@ -134,9 +78,10 @@ RUN set -x \
13478
# These are also installed last as they are needed
13579
# during container run and can have the same deps w/
13680
&& apt-get install -y --no-install-recommends \
137-
pkg-config postgresql-client-12 \
81+
pkg-config postgresql-client-12 nodejs \
13882
&& apt-get clean \
139-
&& rm -rf /var/lib/apt/lists/*
83+
&& rm -rf /var/lib/apt/lists/* \
84+
&& npm install mjml
14085

14186
EXPOSE 8000
14287
VOLUME /var/lib/dispatch/files

0 commit comments

Comments
 (0)