Spaces:
Running
Running
| # DataVision AI — Docker Compose | |
| # Development environment with PostgreSQL, Redis, and hot-reload | |
| version: '3.8' | |
| services: | |
| # ============================================ | |
| # PostgreSQL Database | |
| # ============================================ | |
| postgres: | |
| image: postgres:16-alpine | |
| ports: | |
| - "5433:5432" | |
| environment: | |
| POSTGRES_DB: datavision | |
| POSTGRES_USER: datavision | |
| POSTGRES_PASSWORD: datavision_dev | |
| volumes: | |
| - postgres_data:/var/lib/postgresql/data | |
| restart: unless-stopped | |
| healthcheck: | |
| test: ["CMD-SHELL", "pg_isready -U datavision"] | |
| interval: 10s | |
| timeout: 5s | |
| retries: 5 | |
| # ============================================ | |
| # Redis Cache | |
| # ============================================ | |
| redis: | |
| image: redis:7-alpine | |
| ports: | |
| - "6379:6379" | |
| volumes: | |
| - redis_data:/data | |
| restart: unless-stopped | |
| command: redis-server --appendonly yes | |
| healthcheck: | |
| test: ["CMD", "redis-cli", "ping"] | |
| interval: 10s | |
| timeout: 5s | |
| retries: 5 | |
| # ============================================ | |
| # Backend API | |
| # ============================================ | |
| backend: | |
| build: | |
| context: . | |
| dockerfile: Dockerfile | |
| ports: | |
| - "7860:7860" | |
| environment: | |
| - ENVIRONMENT=development | |
| - DATABASE_URL=postgresql+asyncpg://datavision:datavision_dev@postgres:5432/datavision | |
| - JWT_SECRET=dev-jwt-secret-change-in-production | |
| - REDIS_URL=redis://redis:6379 | |
| - CORS_ORIGINS=http://localhost:5173,http://localhost:3000,http://localhost:7860 | |
| - GROQ_API_KEY=${GROQ_API_KEY:-} | |
| - GOOGLE_API_KEY=${GOOGLE_API_KEY:-} | |
| - OPENAI_API_KEY=${OPENAI_API_KEY:-} | |
| volumes: | |
| - ./storage:/app/storage | |
| - ./backend:/app/backend | |
| depends_on: | |
| postgres: | |
| condition: service_healthy | |
| redis: | |
| condition: service_healthy | |
| restart: unless-stopped | |
| healthcheck: | |
| test: ["CMD", "curl", "-f", "http://localhost:7860/health"] | |
| interval: 30s | |
| timeout: 10s | |
| start_period: 15s | |
| retries: 3 | |
| # ============================================ | |
| # Frontend Dev Server (optional) | |
| # ============================================ | |
| frontend: | |
| image: node:20-alpine | |
| working_dir: /app | |
| ports: | |
| - "5173:5173" | |
| environment: | |
| - VITE_API_URL=http://localhost:7860 | |
| volumes: | |
| - ./frontend:/app | |
| - /app/node_modules | |
| command: sh -c "npm install && npm run dev -- --host" | |
| profiles: | |
| - dev | |
| volumes: | |
| postgres_data: | |
| redis_data: | |
| networks: | |
| default: | |
| name: datavision-network | |