rearrange: add dockerfile

This commit is contained in:
adelyaou 2025-12-22 11:27:03 +07:00
parent e58b5c70c3
commit 93d41e8ded
1 changed files with 30 additions and 0 deletions

30
Dockerfile Normal file
View File

@ -0,0 +1,30 @@
### 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"]