diff --git a/Dockerfile b/Dockerfile index 19c805e..65c41aa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,6 @@ # Use Debian as build OS (https://github.com/nodejs/docker-node/issues/1973) FROM node:slim AS BUILD -# Set default env variable values -ENV PORT=3000 -ENV IMG_PATH="img/background" -ENV ORIGIN="http://localhost:3000" -ENV UNIFI_SITE="default" -ENV UNIFI_PORT="443" -ENV UNIFI_TLS=false -ENV REDIS_HOST="redis" -ENV REDIS_PORT=6379 ENV NODE_ENV="production" # Set the working directory in the container @@ -24,10 +15,21 @@ RUN npm i --verbose # Use Alpine Linux as base image FROM node:alpine +# Set default env variable values +ENV PORT=3000 +ENV IMG_PATH="img/background" +ENV ORIGIN="http://localhost:3000" +ENV UNIFI_SITE="default" +ENV UNIFI_PORT="443" +ENV UNIFI_TLS=false +ENV REDIS_HOST="redis" +ENV REDIS_PORT=6379 +ENV NODE_ENV="production" + WORKDIR /app -# Copy from the build stage -COPY --from=0 . . +# Copy modules from the build stage +COPY --from=0 /app/node_modules ./node_modules # Copy the rest of the application code COPY . .