33 lines
1.0 KiB
Docker
33 lines
1.0 KiB
Docker
FROM node:22-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
COPY package*.json ./
|
|
COPY prisma ./prisma
|
|
RUN npm ci
|
|
RUN npx prisma generate
|
|
COPY . .
|
|
RUN npm run build
|
|
|
|
# ─────────────────────────────────────────────────────────────────────────────
|
|
|
|
FROM node:22-alpine AS runner
|
|
|
|
WORKDIR /app
|
|
ENV NODE_ENV=production
|
|
|
|
COPY package*.json ./
|
|
COPY prisma ./prisma
|
|
RUN npm ci --omit=dev
|
|
|
|
# prisma CLI is a devDependency so it's absent after --omit=dev.
|
|
# Copy the CLI and the generated client from the builder stage so that
|
|
# `npx prisma migrate deploy` works when the migrate service runs this image.
|
|
COPY --from=builder /app/node_modules/.prisma ./node_modules/.prisma
|
|
COPY --from=builder /app/node_modules/prisma ./node_modules/prisma
|
|
COPY --from=builder /app/node_modules/.bin/prisma ./node_modules/.bin/prisma
|
|
|
|
COPY --from=builder /app/dist ./dist
|
|
|
|
EXPOSE 3001
|
|
CMD ["node", "dist/main.js"]
|