Spaces:
Build error
Build error
| version: '3.8' | |
| services: | |
| product-image-update: | |
| build: | |
| context: . | |
| dockerfile: Dockerfile | |
| ports: | |
| - "7860:7860" | |
| environment: | |
| # Copy from .env file or set directly | |
| - HF_TOKEN=${HF_TOKEN} | |
| - CUDA_VISIBLE_DEVICES=${CUDA_VISIBLE_DEVICES:-0} | |
| - PYTORCH_CUDA_ALLOC_CONF=max_split_size_mb:512 | |
| - TRANSFORMERS_CACHE=/app/.cache/huggingface | |
| - HF_HOME=/app/.cache/huggingface | |
| - GRADIO_SERVER_NAME=0.0.0.0 | |
| - GRADIO_SERVER_PORT=7860 | |
| - DEBUG=${DEBUG:-false} | |
| volumes: | |
| # Mount cache directories for faster restarts | |
| - huggingface-cache:/app/.cache/huggingface | |
| - torch-cache:/app/.cache/torch | |
| - models-cache:/app/models | |
| # Mount processed images directory | |
| - ./processed_imgs:/app/processed_imgs | |
| # For development - mount source code | |
| - ./app.py:/app/app.py:ro | |
| - ./utils.py:/app/utils.py:ro | |
| - ./image-download:/app/image-download:ro | |
| - ./remove-background:/app/remove-background:ro | |
| - ./bounding-box:/app/bounding-box:ro | |
| - ./cropping-padding:/app/cropping-padding:ro | |
| - ./return-images:/app/return-images:ro | |
| deploy: | |
| resources: | |
| limits: | |
| memory: 16G | |
| reservations: | |
| devices: | |
| - driver: nvidia | |
| count: 1 | |
| capabilities: [gpu] | |
| healthcheck: | |
| test: ["CMD", "curl", "-f", "http://localhost:7860/health"] | |
| interval: 30s | |
| timeout: 10s | |
| retries: 3 | |
| start_period: 60s | |
| restart: unless-stopped | |
| networks: | |
| - app-network | |
| # Optional: Nginx reverse proxy for production | |
| nginx: | |
| image: nginx:alpine | |
| ports: | |
| - "80:80" | |
| - "443:443" | |
| volumes: | |
| - ./nginx.conf:/etc/nginx/nginx.conf:ro | |
| - ./ssl:/etc/nginx/ssl:ro | |
| depends_on: | |
| - product-image-update | |
| networks: | |
| - app-network | |
| profiles: | |
| - production | |
| # Optional: Monitoring with Prometheus | |
| prometheus: | |
| image: prom/prometheus:latest | |
| ports: | |
| - "9090:9090" | |
| volumes: | |
| - ./prometheus.yml:/etc/prometheus/prometheus.yml:ro | |
| - prometheus-data:/prometheus | |
| command: | |
| - '--config.file=/etc/prometheus/prometheus.yml' | |
| - '--storage.tsdb.path=/prometheus' | |
| networks: | |
| - app-network | |
| profiles: | |
| - monitoring | |
| # Optional: Grafana for visualization | |
| grafana: | |
| image: grafana/grafana:latest | |
| ports: | |
| - "3000:3000" | |
| environment: | |
| - GF_SECURITY_ADMIN_PASSWORD=admin | |
| volumes: | |
| - grafana-data:/var/lib/grafana | |
| depends_on: | |
| - prometheus | |
| networks: | |
| - app-network | |
| profiles: | |
| - monitoring | |
| volumes: | |
| huggingface-cache: | |
| driver: local | |
| torch-cache: | |
| driver: local | |
| models-cache: | |
| driver: local | |
| prometheus-data: | |
| driver: local | |
| grafana-data: | |
| driver: local | |
| networks: | |
| app-network: | |
| driver: bridge |