44 lines
1.0 KiB
Docker
44 lines
1.0 KiB
Docker
# Stage 1: Build frontend
|
|
FROM node:20-alpine AS frontend-builder
|
|
|
|
WORKDIR /app/frontend
|
|
|
|
# Copy frontend package files
|
|
COPY frontend/package.json frontend/pnpm-lock.yaml* ./
|
|
RUN npm install
|
|
|
|
# Copy frontend source
|
|
COPY frontend/ ./
|
|
|
|
# Build frontend
|
|
RUN npm run build
|
|
|
|
# Stage 2: Production
|
|
FROM node:20-alpine
|
|
|
|
WORKDIR /app
|
|
|
|
# Install docker CLI for docker compose commands
|
|
RUN apk add --no-cache docker-cli docker-cli-compose git curl unzip bash openssh-client
|
|
|
|
# Configure git global identity to avoid "Author identity unknown" errors
|
|
RUN git config --global user.email "admin@santinova-soft.org" && \
|
|
git config --global user.name "Manus Dashboard"
|
|
|
|
# Installer les dépendances backend depuis un verrou versionné pour un build déterministe.
|
|
COPY backend/package.json backend/package-lock.json ./backend/
|
|
WORKDIR /app/backend
|
|
RUN npm ci --omit=dev
|
|
|
|
COPY backend/ ./
|
|
|
|
# Copy built frontend
|
|
WORKDIR /app
|
|
COPY --from=frontend-builder /app/frontend/dist ./frontend/dist
|
|
|
|
WORKDIR /app/backend
|
|
|
|
EXPOSE 3001
|
|
|
|
CMD ["node", "src/index.js"]
|