mirror of
https://github.com/R0m1k3/Regisflow.git
synced 2026-10-12 01:39:58 +02:00
Fixes a static asset serving issue by updating the Dockerfile to copy public assets. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 91318273-c764-4fd4-be04-bdc12c38af32 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/0715008c-7244-40f4-befc-26c014852236/1a628c74-3aad-4182-a42f-aeae036e6dcf.jpg
87 lines
2.6 KiB
Docker
87 lines
2.6 KiB
Docker
# Dockerfile multi-stage pour RegisFlow Production
|
|
# Stage 1: Build
|
|
FROM node:18-alpine AS builder
|
|
|
|
# Installer les dépendances de build
|
|
RUN apk add --no-cache python3 make g++
|
|
|
|
# Créer le répertoire de build
|
|
WORKDIR /build
|
|
|
|
# Copier les fichiers de dépendances
|
|
COPY package*.json ./
|
|
|
|
# Installer toutes les dépendances (dev + prod)
|
|
RUN npm ci --include=dev
|
|
|
|
# Copier le code source
|
|
COPY . .
|
|
|
|
# Construire l'application
|
|
RUN npm run build
|
|
|
|
# Stage 2: Production
|
|
FROM node:18-alpine AS production
|
|
|
|
# Installer uniquement les dépendances système nécessaires pour production
|
|
RUN apk add --no-cache \
|
|
dumb-init \
|
|
postgresql-client \
|
|
wget \
|
|
curl \
|
|
&& rm -rf /var/cache/apk/*
|
|
|
|
# Créer un utilisateur non-root avec des permissions limitées
|
|
RUN addgroup -g 1001 -S nodejs && \
|
|
adduser -S regisflow -u 1001 -G nodejs
|
|
|
|
# Créer les répertoires avec permissions appropriées
|
|
WORKDIR /app
|
|
RUN mkdir -p /app/backups /app/logs /app/data && \
|
|
chown -R regisflow:nodejs /app
|
|
|
|
# Copier uniquement les fichiers nécessaires depuis le builder
|
|
COPY --from=builder --chown=regisflow:nodejs /build/package*.json ./
|
|
COPY --from=builder --chown=regisflow:nodejs /build/dist ./dist
|
|
COPY --from=builder --chown=regisflow:nodejs /build/shared ./shared
|
|
COPY --from=builder --chown=regisflow:nodejs /build/server/prod-start.js ./server/
|
|
COPY --from=builder --chown=regisflow:nodejs /build/drizzle.config.ts ./
|
|
COPY --from=builder --chown=regisflow:nodejs /build/node_modules ./node_modules
|
|
|
|
# Copier les assets client au bon endroit pour serveStatic
|
|
COPY --from=builder --chown=regisflow:nodejs /build/dist/public ./public
|
|
|
|
# Les dépendances sont déjà copiées depuis le builder
|
|
# Nettoyer le cache npm uniquement
|
|
RUN npm cache clean --force && \
|
|
rm -rf /tmp/*
|
|
|
|
# Copier les scripts de configuration
|
|
COPY --chown=regisflow:nodejs docker-entrypoint-simple.sh /usr/local/bin/docker-entrypoint.sh
|
|
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
|
|
|
|
# Changer vers l'utilisateur non-root
|
|
USER regisflow
|
|
|
|
# Exposer le port
|
|
EXPOSE 5000
|
|
|
|
# Variables d'environnement de production
|
|
ENV NODE_ENV=production
|
|
ENV PORT=5000
|
|
ENV NODE_OPTIONS="--max-old-space-size=512"
|
|
|
|
# Labels pour la documentation
|
|
LABEL maintainer="RegisFlow Team"
|
|
LABEL version="1.0.0"
|
|
LABEL description="Application RegisFlow pour la gestion des ventes de feux d'artifice"
|
|
|
|
# Health check amélioré
|
|
HEALTHCHECK --interval=30s --timeout=15s --start-period=90s --retries=3 \
|
|
CMD wget --no-verbose --tries=1 --spider http://localhost:5000/health || exit 1
|
|
|
|
# Utiliser dumb-init pour gérer les signaux
|
|
ENTRYPOINT ["dumb-init", "--"]
|
|
|
|
# Démarrer avec le script d'entrée
|
|
CMD ["docker-entrypoint.sh"] |