30 lines
556 B
Docker
30 lines
556 B
Docker
# Build the application with a specific environment
|
|
FROM node:20 AS builder
|
|
|
|
WORKDIR /usr/src/app
|
|
|
|
ARG envFile=.env
|
|
|
|
COPY . .
|
|
COPY ./${envFile} ./.env
|
|
|
|
RUN npm ci
|
|
RUN npm run build
|
|
|
|
# Create the executor image
|
|
FROM node:20
|
|
|
|
WORKDIR /app
|
|
|
|
COPY --from=builder --chown=node:node /usr/src/app/build ./build
|
|
COPY --from=builder --chown=node:node /usr/src/app/migrations ./migrations
|
|
COPY --from=builder --chown=node:node /usr/src/app/package* .
|
|
RUN npm ci --omit=dev
|
|
|
|
USER node
|
|
|
|
VOLUME [ "/app/private" ]
|
|
VOLUME [ "/app/uploads" ]
|
|
|
|
CMD [ "node", "/app/build" ]
|