From 1ddb715eda5f543a4c5500a0c6f7e422acf9ab77 Mon Sep 17 00:00:00 2001 From: Manus Deploy Date: Tue, 28 Apr 2026 12:12:13 -0400 Subject: [PATCH] =?UTF-8?q?feat:=20d=C3=A9ploiement=20initial=20recette=20?= =?UTF-8?q?Santinova?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .dockerignore | 11 +++++++ Dockerfile | 68 ++++++++++++++++++++++++++++++++++++++++ docker-compose.yml | 77 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 156 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..44ef498 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,11 @@ +node_modules +dist +client/dist +.env +.env.* +*.log +.git +.gitignore +README.md +uploads +storage diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..2f85905 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,68 @@ +# ============================================================ +# STAGE 1: Build Frontend + Backend +# ============================================================ +FROM node:22-alpine AS builder + +# Install system dependencies for sharp and pdf processing +RUN apk add --no-cache \ + python3 \ + make \ + g++ \ + poppler-utils \ + vips-dev + +WORKDIR /app + +# Install pnpm +RUN npm install -g pnpm@10.4.1 + +# Copy package files +COPY package.json pnpm-lock.yaml ./ +COPY patches/ ./patches/ + +# Install dependencies +RUN pnpm install --frozen-lockfile + +# Copy source code +COPY . . + +# Build frontend + backend +RUN pnpm build + +# ============================================================ +# STAGE 2: Production image +# ============================================================ +FROM node:22-alpine AS production + +# Install runtime dependencies +RUN apk add --no-cache \ + poppler-utils \ + vips \ + curl + +WORKDIR /app + +# Install pnpm for production deps +RUN npm install -g pnpm@10.4.1 + +# Copy package files +COPY package.json pnpm-lock.yaml ./ +COPY patches/ ./patches/ + +# Install production dependencies only +RUN pnpm install --frozen-lockfile --prod + +# Copy built assets from builder +COPY --from=builder /app/dist ./dist +COPY --from=builder /app/client/dist ./client/dist + +# Copy drizzle migrations +COPY drizzle/ ./drizzle/ +COPY drizzle.config.ts ./ + +# Create uploads directory +RUN mkdir -p /app/uploads + +EXPOSE 3000 + +CMD ["node", "dist/index.js"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..faf9538 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,77 @@ +services: + # ============================================================ + # MySQL Database + # ============================================================ + demat-facturation-db: + image: mysql:8.0 + container_name: demat-facturation-db + restart: unless-stopped + command: --innodb-use-native-aio=0 --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci + environment: + MYSQL_ROOT_PASSWORD: demat_facturation_db_pass_2026 + MYSQL_DATABASE: gestion_facturation + volumes: + - demat_facturation_mysql_data:/var/lib/mysql + networks: + - demat-facturation-internal + healthcheck: + test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-pdemat_facturation_db_pass_2026"] + interval: 10s + timeout: 5s + retries: 5 + start_period: 30s + + # ============================================================ + # Application (Backend + Frontend) + # ============================================================ + demat-facturation-app: + build: + context: . + dockerfile: Dockerfile + container_name: demat-facturation-app + restart: unless-stopped + depends_on: + demat-facturation-db: + condition: service_healthy + environment: + NODE_ENV: production + PORT: 3000 + DATABASE_URL: mysql://root:demat_facturation_db_pass_2026@demat-facturation-db:3306/gestion_facturation + JWT_SECRET: demat-facturation-jwt-secret-recette-2026 + MISTRAL_API_KEY: ${MISTRAL_API_KEY:-} + UPLOAD_DIR: /app/uploads + # Manus OAuth (optionnel en recette) + VITE_APP_ID: ${VITE_APP_ID:-demat-facturation-recette} + OAUTH_SERVER_URL: ${OAUTH_SERVER_URL:-} + VITE_OAUTH_PORTAL_URL: ${VITE_OAUTH_PORTAL_URL:-} + OWNER_OPEN_ID: ${OWNER_OPEN_ID:-} + OWNER_NAME: ${OWNER_NAME:-Administrateur} + volumes: + - demat_facturation_uploads:/app/uploads + networks: + - demat-facturation-internal + - web + labels: + - "traefik.enable=true" + - "traefik.http.routers.demat-facturation.rule=Host(`demat-facturation.recette.santinova-soft.org`)" + - "traefik.http.routers.demat-facturation.entrypoints=websecure" + - "traefik.http.routers.demat-facturation.tls.certresolver=letsencrypt" + - "traefik.http.services.demat-facturation.loadbalancer.server.port=3000" + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:3000/api/health"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 60s + +volumes: + demat_facturation_mysql_data: + driver: local + demat_facturation_uploads: + driver: local + +networks: + demat-facturation-internal: + driver: bridge + web: + external: true