-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdockerfile
More file actions
50 lines (35 loc) · 1.27 KB
/
Copy pathdockerfile
File metadata and controls
50 lines (35 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# --- STAGE 1 : Build backend (NestJS) ---
FROM node:20-alpine AS backend-builder
WORKDIR /app
# Copier uniquement les fichiers nécessaires
COPY package.json pnpm-lock.yaml* pnpm-workspace.yaml ./
COPY apps/edge-api ./apps/edge-api
COPY libs ./libs
# Installer PNPM
RUN npm install -g pnpm
# Installer dépendances + build backend
RUN pnpm install --frozen-lockfile
RUN pnpm --filter edge-api build
# --- STAGE 2 : Build frontend (React/Vite) ---
FROM node:20-alpine AS frontend-builder
WORKDIR /app
COPY package.json pnpm-lock.yaml* pnpm-workspace.yaml ./
COPY apps/frontend ./apps/frontend
COPY libs ./libs
RUN npm install -g pnpm
RUN pnpm install --frozen-lockfile
RUN pnpm --filter frontend build
# --- STAGE 3 : Runner (prod only) ---
FROM node:20-alpine AS runner
WORKDIR /app
# Copier manifest global + manifest edge-api
COPY package.json pnpm-lock.yaml* pnpm-workspace.yaml ./
COPY apps/edge-api/package.json ./apps/edge-api/
RUN npm install -g pnpm
# Installer uniquement les deps prod pour edge-api
RUN pnpm install --filter edge-api --prod --frozen-lockfile
# Copier les dist
COPY --from=backend-builder /app/apps/edge-api/dist ./apps/edge-api/dist
COPY --from=frontend-builder /app/apps/frontend/dist ./apps/frontend/dist
EXPOSE 3000
CMD ["node", "apps/edge-api/dist/main.js"]