This repository has been archived on 2024-10-29. You can view files and clone it, but cannot push or open issues or pull requests.
file-uploads-api/Dockerfile

27 lines
892 B
Docker
Raw Permalink Normal View History

FROM node:20.9.0 AS builder-dependencies
2023-07-22 16:24:52 +02:00
WORKDIR /usr/src/application
COPY ./package*.json ./
RUN npm clean-install
FROM node:20.9.0 AS runner-dependencies
2023-07-22 16:24:52 +02:00
WORKDIR /usr/src/application
ENV NODE_ENV=production
COPY ./package*.json ./
RUN npm clean-install --omit=dev --ignore-scripts
FROM node:20.9.0 AS builder
2023-07-22 16:24:52 +02:00
WORKDIR /usr/src/application
COPY --from=builder-dependencies /usr/src/application/node_modules ./node_modules
COPY ./ ./
RUN npm run build
FROM gcr.io/distroless/nodejs20-debian12:latest AS runner
2023-07-22 16:24:52 +02:00
WORKDIR /usr/src/application
ENV NODE_ENV=production
ENV NODE_OPTIONS=--enable-source-maps
COPY --from=runner-dependencies /usr/src/application/node_modules ./node_modules
COPY --from=builder /usr/src/application/package.json ./package.json
COPY --from=builder /usr/src/application/build ./build
COPY --from=builder /usr/src/application/uploads ./uploads
CMD ["./build/index.js"]