feat : Add Dockerfile and .dockerignore for containerization setup

This commit is contained in:
Thibault Pouch
2026-05-01 10:53:34 +02:00
commit 2f7417c7fb
2 changed files with 26 additions and 0 deletions

4
.dockerignore Normal file
View File

@@ -0,0 +1,4 @@
node_modules
dist
.env
.git

22
Dockerfile Normal file
View File

@@ -0,0 +1,22 @@
FROM node:current-alpine AS base
WORKDIR /app
COPY package*.json ./
RUN npm ci
FROM base AS dev
ENV PORT=3000
EXPOSE 3000
CMD ["npm", "run", "start:dev"]
FROM base AS builder
COPY . .
RUN npx prisma generate
RUN npm run build
FROM node:current-alpine AS prod
WORKDIR /app
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/prisma ./prisma
EXPOSE 3000
CMD ["node", "dist/main.js"]