From 3ef50396cdf987dc0b8c0bd77806e126aec1fa03 Mon Sep 17 00:00:00 2001 From: sct Date: Tue, 24 Nov 2020 15:31:29 +0000 Subject: [PATCH] build: switch to multi-stage docker build to reduce size --- Dockerfile | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index b93557fab..e5198a4bc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM node:12.18-alpine +FROM node:12.18-alpine AS BUILD_IMAGE COPY . /app WORKDIR /app @@ -10,4 +10,14 @@ RUN yarn --frozen-lockfile && \ RUN yarn install --production --ignore-scripts --prefer-offline RUN yarn cache clean +FROM node:12.18-alpine + +COPY . /app +WORKDIR /app + +# copy from build image +COPY --from=BUILD_IMAGE /app/dist ./dist +COPY --from=BUILD_IMAGE /app/.next ./.next +COPY --from=BUILD_IMAGE /app/node_modules ./node_modules + CMD yarn start