File size: 1,627 Bytes
3a32bd4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# ============================================
# Certificate Verification AI Service
# Docker Compose - Local Development & Production
# ============================================

services:
  # ---- AI Verification API ----
  cert-verify-api:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: cert-verify-api
    restart: unless-stopped
    ports:
      - "${PORT:-8080}:${PORT:-8080}"
    env_file:
      - .env
    environment:
      - PORT=${PORT:-8080}
      - WORKERS=${WORKERS:-1}
      - LOG_LEVEL=${LOG_LEVEL:-info}
      - SKIP_MODEL_LOADING=${SKIP_MODEL_LOADING:-false}
    volumes:
      # Persist downloaded models across container restarts
      - model-cache:/app/models
      - vit-cache:/app/vit_cache
    deploy:
      resources:
        limits:
          memory: 4G
        reservations:
          memory: 2G
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:${PORT:-8080}/health"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 120s
    logging:
      driver: json-file
      options:
        max-size: "10m"
        max-file: "3"

  # ---- Nginx Reverse Proxy (optional, for production) ----
  nginx:
    image: nginx:1.25-alpine
    container_name: cert-verify-nginx
    restart: unless-stopped
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
      - ./nginx/certs:/etc/nginx/certs:ro
    depends_on:
      cert-verify-api:
        condition: service_healthy
    profiles:
      - production

volumes:
  model-cache:
    driver: local
  vit-cache:
    driver: local