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: