All checks were successful
Build & Deploy SimO / 🏗️ Build & Deploy (push) Successful in 1m15s
37 lines
1.1 KiB
Docker
37 lines
1.1 KiB
Docker
# ── Stage 1: Build ────────────────────────────────────────────────────────────
|
|
FROM node:18-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Installer les dépendances d'abord (cache Docker)
|
|
COPY package*.json ./
|
|
RUN npm ci
|
|
|
|
# Copier le code source et builder
|
|
COPY . .
|
|
RUN npm run build
|
|
|
|
# ── Stage 2: Production (nginx pour servir le static export) ─────────────────
|
|
FROM nginx:alpine
|
|
|
|
# Installer curl pour le healthcheck
|
|
RUN apk add --no-cache curl
|
|
|
|
# Copier la config nginx personnalisée
|
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
|
|
|
# Copier le build statique depuis le stage builder
|
|
COPY --from=builder /app/out /usr/share/nginx/html
|
|
|
|
# Script d'entrée
|
|
COPY docker-entrypoint.sh /
|
|
RUN chmod +x /docker-entrypoint.sh
|
|
|
|
EXPOSE 3000
|
|
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \
|
|
CMD curl -f http://localhost:3000/ || exit 1
|
|
|
|
ENTRYPOINT ["/docker-entrypoint.sh"]
|
|
CMD ["nginx", "-g", "daemon off;"]
|