monofile/Dockerfile
2024-04-28 05:26:43 -04:00

27 lines
639 B
Docker

FROM node:21-alpine AS base
WORKDIR /usr/src/app
FROM base AS install
RUN mkdir -p /tmp/dev
COPY package.json package-lock.json /tmp/dev/
RUN cd /tmp/dev && npm install
RUN mkdir -p /tmp/prod
COPY package.json package-lock.json /tmp/prod/
RUN cd /tmp/prod && npm install --omit=dev
FROM base AS build
COPY --from=install /tmp/dev/node_modules node_modules
COPY . .
RUN npm run build
FROM base AS app
COPY --from=install /tmp/prod/node_modules node_modules
COPY --from=build /usr/src/app/out out
COPY --from=build /usr/src/app/dist dist
COPY package.json .
COPY assets assets
EXPOSE 3000
ENTRYPOINT [ "node", "./out/server/index.js" ]