30 lines
621 B
Docker
30 lines
621 B
Docker
### Builder stage: install deps and generate Prisma clients
|
|
FROM node:20-alpine AS builder
|
|
WORKDIR /app
|
|
|
|
COPY package*.json package-lock.json ./
|
|
COPY prisma ./prisma
|
|
|
|
RUN npm ci
|
|
|
|
COPY . .
|
|
|
|
### Production stage: smaller runtime image
|
|
FROM node:20-alpine AS runner
|
|
WORKDIR /app
|
|
|
|
RUN addgroup -S app && adduser -S app -G app
|
|
|
|
COPY --from=builder /app/app ./app
|
|
COPY --from=builder /app/prisma ./prisma
|
|
COPY --from=builder /app/index.js ./index.js
|
|
COPY --from=builder /app/node_modules ./node_modules
|
|
COPY --from=builder /app/package*.json ./
|
|
|
|
RUN chown -R app:app /app/prisma
|
|
|
|
USER app
|
|
|
|
EXPOSE 3000
|
|
|
|
CMD ["node", "index.js"] |