From cf6e287ca6a2200dad54f5c32269422ff3ca1a13 Mon Sep 17 00:00:00 2001 From: Aaron Schweig Date: Thu, 18 Mar 2021 11:19:22 +0100 Subject: [PATCH] adds build args to the right image --- Dockerfile | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6308316..c493339 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,6 +2,19 @@ FROM node:latest as build WORKDIR /app +COPY *.json ./ +COPY yarn.lock . +RUN yarn install --link-duplicates --ignore-optional + + +COPY ./ ./ +RUN yarn build +RUN yarn install --production --link-duplicates --ignore-optional + + +FROM node:alpine as prod +EXPOSE 3000 + ARG MONGO_CONNECTION_ARG ARG JWT_SECRET_ARG ARG REDIS_HOST_ARG @@ -18,18 +31,6 @@ ENV REDIS_USER=$REDIS_USER_ARG ENV REDIS_PW=$REDIS_PW_ARG ENV REDIS_DB=$REDIS_DB_ARG -COPY *.json ./ -COPY yarn.lock . -RUN yarn install --link-duplicates --ignore-optional - - -COPY ./ ./ -RUN yarn build -RUN yarn install --production --link-duplicates --ignore-optional - - -FROM node:alpine as prod -EXPOSE 3000 WORKDIR /app USER node ENV NODE_ENV production