feat: déploiement initial recette Santinova
This commit is contained in:
11
.dockerignore
Normal file
11
.dockerignore
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
node_modules
|
||||||
|
dist
|
||||||
|
client/dist
|
||||||
|
.env
|
||||||
|
.env.*
|
||||||
|
*.log
|
||||||
|
.git
|
||||||
|
.gitignore
|
||||||
|
README.md
|
||||||
|
uploads
|
||||||
|
storage
|
||||||
68
Dockerfile
Normal file
68
Dockerfile
Normal file
@@ -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"]
|
||||||
77
docker-compose.yml
Normal file
77
docker-compose.yml
Normal file
@@ -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
|
||||||
Reference in New Issue
Block a user