File size: 2,516 Bytes
4cef597
 
 
 
 
 
 
 
82f53e7
 
 
 
 
 
4cef597
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82f53e7
4cef597
 
 
 
82f53e7
 
4cef597
 
82f53e7
4cef597
 
 
 
 
82f53e7
 
4cef597
82f53e7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4cef597
 
 
 
82f53e7
 
4cef597
 
 
 
82f53e7
 
4cef597
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
version: '3.8'

services:
  redis:
    image: redis:7-alpine
    restart: unless-stopped
    # ponytail: no persistence needed for rate-limit counters
    command: redis-server --save ""
    deploy:
      resources:
        limits:
          cpus: '0.5'
          memory: 256M


  app:
    build:
      context: ./ldv-backend
      dockerfile: Dockerfile
    environment:
      - LDV_DB_PATH=/app/data/sydeco.db
      - LDV_SECRET_KEY=${LDV_SECRET_KEY}
      - LDV_ENCRYPTION_KEY=${LDV_ENCRYPTION_KEY}
      - LDV_RETENTION_DAYS=${LDV_RETENTION_DAYS}
      - LDV_RATELIMIT_STORAGE_URL=redis://redis:6379
      - LDV_DOWNLOAD_MODELS=${LDV_DOWNLOAD_MODELS:-0}
      # local = offline Helsinki-NLP Marian MT (no Google); required for correct
      # FR/NL/ID document-type classification — DistilBERT-MNLI is English-only
      # and is either confidently wrong or returns null on untranslated text.
      - LDV_REMOTE_TRANSLATION=${LDV_REMOTE_TRANSLATION:-local}
      - LIGHTML_TRANSLATOR_URL=http://lightml-translator:8000/api/v1/translate
    volumes:
      - ./ldv-backend/data:/app/data
      - ./uploads:/app/uploads
      - ~/.cache/huggingface:/root/.cache/huggingface
      - ./datasets:/datasets
      - ./ldv-frontend:/ldv-frontend
    depends_on:
      - redis
      - lightml-translator
    # Not exposed directly — nginx is the only ingress
    expose:
      - "5000"
    restart: unless-stopped
    healthcheck:
      test: ["CMD", "curl", "-f", "http://127.0.0.1:5000/health"]
      interval: 15s
      timeout: 10s
      retries: 5
      start_period: 60s
    command: gunicorn -w 1 --threads 4 --worker-class gthread -b 0.0.0.0:5000 --timeout 120 --graceful-timeout 100 app:app
    deploy:
      resources:
        limits:
          cpus: '2.0'
          memory: 1500M


  lightml-translator:
    build:
      context: ./lightml-translator
      dockerfile: Dockerfile
    environment:
      - ENV=production
      - LIGHTML_MODELS_DIR=/app/models
    volumes:
      - ./lightml-translator/models:/app/models
      - ~/.cache/huggingface:/root/.cache/huggingface
    ports:
      - "8000:8000"
    restart: unless-stopped
    deploy:
      resources:
        limits:
          cpus: '2.0'
          memory: 1000M



  nginx:
    image: nginx:alpine
    ports:
      - "8080:80"
      - "8443:443"
    volumes:
      - ./deploy/nginx.conf:/etc/nginx/nginx.conf:ro
      - ./deploy/certs:/etc/nginx/certs:ro
    depends_on:
      app:
        condition: service_healthy
    restart: unless-stopped