2024-06-04 18:28:38 +00:00
|
|
|
# Build the application with a specific environment
|
2024-06-12 16:33:28 +00:00
|
|
|
FROM node:20-alpine AS builder
|
2024-06-04 18:28:38 +00:00
|
|
|
|
|
|
|
WORKDIR /usr/src/app
|
|
|
|
|
|
|
|
COPY . .
|
|
|
|
|
|
|
|
RUN npm ci
|
|
|
|
RUN npm run build
|
|
|
|
|
|
|
|
# Create the executor image
|
2024-06-12 16:33:28 +00:00
|
|
|
FROM node:20-alpine
|
2024-06-04 18:28:38 +00:00
|
|
|
|
|
|
|
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" ]
|