Skip to content

Commit

Permalink
Limit copying from BUILD to node_modules
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlgo11 committed May 20, 2024
1 parent fb58c1e commit 8a3184d
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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 . .
Expand Down

0 comments on commit 8a3184d

Please sign in to comment.