From a971a3cff524a55446f45515db2e8f2441b0d882 Mon Sep 17 00:00:00 2001 From: Jesse Chan Date: Fri, 11 Dec 2020 13:30:34 +0800 Subject: [PATCH] Dockerfile: flatten Docker image layers --- Dockerfile | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6ff4e2a1..6da101f0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,8 +24,8 @@ RUN npm ci --no-optional RUN cp config.cli.js config.js RUN npm pack -# Now get the clean image -FROM ${NODE_IMAGE} as flood +# Now get the clean Node.js image +FROM ${NODE_IMAGE} as install # Copy package built COPY --from=nodebuild /usr/src/app/flood-*.tgz /tmp/ @@ -51,6 +51,11 @@ RUN rm -rf /opt/* # Remove Node.js development files RUN rm -rf /usr/local/include/node +# Get the scratch image +FROM scratch as flood + +COPY --from=install / / + # Create "download" user RUN adduser -h /home/download -s /sbin/nologin --disabled-password download