FROM node:18-alpine AS pnpm RUN npm i -g pnpm FROM pnpm AS builder WORKDIR "/app" COPY . . RUN pnpm i RUN pnpm build RUN pnpm prune --production FROM pnpm AS prod WORKDIR "/app" COPY --from=builder /app/package.json ./package.json COPY --from=builder /app/pnpm-lock.yaml ./pnpm-lock.yaml COPY --from=builder /app/dist ./dist COPY --from=builder /app/node_modules ./node_modules ENV DB_HOST db ENV DB_PORT 3306 ENV DB_USER root ENV DB_PASS secret ENV DB_NAME mx ENV JWT_SECRET secret ENV JWT_EXPIRY 1h CMD ["sh", "-c", "DB_HOST=${DB_HOST} DB_PORT=${DB_PORT} DB_USER=${DB_USER} DB_PASS=${DB_PASS} DB_NAME=${DB_NAME} JWT_SECRET=${JWT_SECRET} JWT_EXPIRY=${JWT_EXPIRY} pnpm run start:prod --host 0.0.0.0"] EXPOSE 3000