Spaces:
Running
Running
| # Local development stack: FastAPI app + Redis | |
| # Usage: docker compose up --build | |
| # The app talks to Redis via the service name "redis" (not localhost). | |
| services: | |
| app: | |
| build: . | |
| ports: | |
| - "7860:7860" | |
| env_file: | |
| - .env | |
| environment: | |
| # Override REDIS_URL so the app reaches the redis service, not its own container. | |
| REDIS_URL: redis://redis:6379 | |
| depends_on: | |
| redis: | |
| condition: service_healthy | |
| restart: unless-stopped | |
| redis: | |
| image: redis:7-alpine | |
| ports: | |
| # Exposed on the host so you can poke it with redis-cli if you like. | |
| - "6379:6379" | |
| volumes: | |
| - redis-data:/data | |
| command: ["redis-server", "--appendonly", "yes"] | |
| healthcheck: | |
| test: ["CMD", "redis-cli", "ping"] | |
| interval: 5s | |
| timeout: 3s | |
| retries: 5 | |
| restart: unless-stopped | |
| volumes: | |
| redis-data: | |