diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..1b0aa55 --- /dev/null +++ b/Dockerfile @@ -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"] \ No newline at end of file