FROM node:22-alpine AS deps WORKDIR /app COPY package.json package-lock.json ./ RUN npm install --production --no-audit --no-fund FROM node:22-alpine AS builder WORKDIR /app COPY package.json package-lock.json ./ RUN npm install --no-audit --no-fund COPY tsconfig.json nest-cli.json vitest.config.ts ./ COPY src/ src/ COPY test/ test/ RUN npx tsc FROM node:22-alpine AS runner WORKDIR /app ENV NODE_ENV=production ENV PORT=3000 RUN addgroup -S appgroup && adduser -S appuser -G appgroup COPY --from=deps /app/node_modules ./node_modules COPY --from=builder /app/dist ./dist USER appuser EXPOSE 3000 CMD ["node", "dist/src/main.js"]