| # Docker Compose configuration for HF Viz with Redis | |
| version: '3.8' | |
| services: | |
| redis: | |
| image: redis:7-alpine | |
| container_name: hfviz-redis | |
| restart: unless-stopped | |
| ports: | |
| - "6379:6379" | |
| volumes: | |
| - redis_data:/data | |
| command: redis-server --appendonly yes --maxmemory 512mb --maxmemory-policy allkeys-lru | |
| healthcheck: | |
| test: ["CMD", "redis-cli", "ping"] | |
| interval: 10s | |
| timeout: 3s | |
| retries: 3 | |
| backend: | |
| build: | |
| context: .. | |
| dockerfile: Dockerfile | |
| container_name: hfviz-backend | |
| restart: unless-stopped | |
| ports: | |
| - "8000:8000" | |
| environment: | |
| - PORT=8000 | |
| - SAMPLE_SIZE=5000 | |
| - REDIS_ENABLED=true | |
| - REDIS_HOST=redis | |
| - REDIS_PORT=6379 | |
| - REDIS_TTL=300 | |
| - FRONTEND_URL=http://localhost:3000 | |
| depends_on: | |
| redis: | |
| condition: service_healthy | |
| volumes: | |
| - ../cache:/app/cache | |
| - ../precomputed_data:/app/precomputed_data | |
| healthcheck: | |
| test: ["CMD", "curl", "-f", "http://localhost:8000/"] | |
| interval: 30s | |
| timeout: 10s | |
| retries: 3 | |
| nginx: | |
| image: nginx:alpine | |
| container_name: hfviz-nginx | |
| restart: unless-stopped | |
| ports: | |
| - "80:80" | |
| volumes: | |
| - ./nginx.conf:/etc/nginx/conf.d/default.conf:ro | |
| - nginx_cache:/var/cache/nginx | |
| depends_on: | |
| - backend | |
| healthcheck: | |
| test: ["CMD", "wget", "-q", "--spider", "http://localhost/health"] | |
| interval: 10s | |
| timeout: 3s | |
| retries: 3 | |
| volumes: | |
| redis_data: | |
| driver: local | |
| nginx_cache: | |
| driver: local | |