diff --git a/web/Dockerfile b/web/Dockerfile index 3cadbfa..d661f57 100644 --- a/web/Dockerfile +++ b/web/Dockerfile @@ -1,21 +1,29 @@ ARG NODE_VERSION=19-alpine +FROM node:${NODE_VERSION} AS base +RUN npm install -g pnpm -FROM node:${NODE_VERSION} - -WORKDIR /usr/src/app +FROM base AS builder +WORKDIR /usr/srv/app COPY --chown=node:node package.json pnpm-lock.yaml ./ -RUN npm i -g pnpm && pnpm install --frozen-lockfile --prod=false +RUN pnpm install --frozen-lockfile COPY --chown=node:node . . RUN pnpm prisma generate && pnpm build -ENV NODE_ENV production +FROM base AS runner +WORKDIR /usr/srv/app +ENV NODE_ENV=production + +COPY --from=builder --chown=node:node /usr/srv/app/package.json /usr/srv/app/pnpm-lock.yaml ./ + +RUN pnpm install --frozen-lockfile --prod -RUN pnpm install -P +COPY --from=builder --chown=node:node /usr/srv/app/build ./ +RUN chown node:node . USER node -CMD pnpm start +CMD ["node", "server.js"] \ No newline at end of file