File size: 1,036 Bytes
b664492
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
services:
  ai-image-detector:
    build:
      context: .
      dockerfile: Dockerfile
    image: ai-image-detector:latest
    container_name: ai-image-detector
    ports:
      - "7860:7860"
    environment:
      # Where the model is cached inside the container (matches the named volume).
      MODEL_DIR: /data/model
      GRADIO_SERVER_NAME: 0.0.0.0
      GRADIO_SERVER_PORT: "7860"
      # Set to "1" to skip the HF download (e.g. if you mount your own weights).
      MODEL_SKIP_DOWNLOAD: ""
      # Optional: only needed for private/gated repos. This one is public.
      HF_TOKEN: ${HF_TOKEN:-}
    volumes:
      # Persist downloaded model artifacts across container recreations.
      - model_cache:/data/model
    restart: unless-stopped
    healthcheck:
      test: ["CMD", "python", "-c", "import urllib.request, sys; sys.exit(0 if urllib.request.urlopen('http://localhost:7860/', timeout=5).status == 200 else 1)"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 60s

volumes:
  model_cache: