Spaces:
Build error
Build error
| version: "3.8" | |
| # ============================================================ | |
| # BankBot AI β Docker Compose | |
| # | |
| # Development: docker compose up -d | |
| # Production: docker compose --profile production up -d | |
| # Seed data: docker compose exec backend python app/scripts/seed_demo.py | |
| # Logs: docker compose logs -f backend | |
| # Stop: docker compose down | |
| # ============================================================ | |
| services: | |
| # βββ PostgreSQL βββββββββββββββββββββββββββββββββββββββββββββ | |
| db: | |
| image: postgres:15-alpine | |
| container_name: bankbot_postgres | |
| restart: unless-stopped | |
| environment: | |
| POSTGRES_USER: ${POSTGRES_USER:-admin} | |
| POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-adminpassword} | |
| POSTGRES_DB: ${POSTGRES_DB:-bankbot} | |
| ports: | |
| - "5432:5432" | |
| volumes: | |
| - pgdata:/var/lib/postgresql/data | |
| healthcheck: | |
| test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-admin} -d ${POSTGRES_DB:-bankbot}"] | |
| interval: 5s | |
| timeout: 5s | |
| retries: 10 | |
| start_period: 10s | |
| # βββ Redis ββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| redis: | |
| image: redis:7-alpine | |
| container_name: bankbot_redis | |
| restart: unless-stopped | |
| command: > | |
| redis-server | |
| --maxmemory 256mb | |
| --maxmemory-policy allkeys-lru | |
| --save 60 1 | |
| ports: | |
| - "6379:6379" | |
| volumes: | |
| - redisdata:/data | |
| healthcheck: | |
| test: ["CMD", "redis-cli", "ping"] | |
| interval: 5s | |
| timeout: 3s | |
| retries: 5 | |
| # βββ Backend ββββββββββββββββββββββββββββββββββββββββββββββββ | |
| backend: | |
| build: | |
| context: ./backend | |
| dockerfile: Dockerfile | |
| target: runtime | |
| container_name: bankbot_backend | |
| restart: unless-stopped | |
| ports: | |
| - "8000:8000" | |
| environment: | |
| DATABASE_URL: postgresql://${POSTGRES_USER:-admin}:${POSTGRES_PASSWORD:-adminpassword}@db:5432/${POSTGRES_DB:-bankbot} | |
| REDIS_URL: redis://redis:6379/0 | |
| OPENAI_API_KEY: ${OPENAI_API_KEY:-} | |
| GROQ_API_KEY: ${GROQ_API_KEY:-} | |
| OLLAMA_MODEL: ${OLLAMA_MODEL:-llama3:latest} | |
| JWT_SECRET_KEY: ${JWT_SECRET_KEY:-bankbot-change-in-production} | |
| JWT_ALGORITHM: HS256 | |
| ACCESS_TOKEN_EXPIRE_MINUTES: "60" | |
| BACKEND_CORS_ORIGINS: '["http://localhost:3000","http://frontend:3000","${FRONTEND_URL:-http://localhost:3000}"]' | |
| depends_on: | |
| db: | |
| condition: service_healthy | |
| redis: | |
| condition: service_healthy | |
| healthcheck: | |
| test: ["CMD", "curl", "-f", "http://localhost:8000/health"] | |
| interval: 15s | |
| timeout: 10s | |
| retries: 5 | |
| start_period: 20s | |
| # βββ Frontend βββββββββββββββββββββββββββββββββββββββββββββββ | |
| frontend: | |
| build: | |
| context: ./frontend | |
| dockerfile: Dockerfile | |
| target: runtime | |
| args: | |
| NEXT_PUBLIC_API_URL: ${NEXT_PUBLIC_API_URL:-http://localhost:8000} | |
| container_name: bankbot_frontend | |
| restart: unless-stopped | |
| ports: | |
| - "3000:3000" | |
| environment: | |
| NEXT_PUBLIC_API_URL: ${NEXT_PUBLIC_API_URL:-http://localhost:8000} | |
| NODE_ENV: production | |
| depends_on: | |
| backend: | |
| condition: service_healthy | |
| healthcheck: | |
| test: ["CMD", "wget", "-qO-", "http://localhost:3000/"] | |
| interval: 30s | |
| timeout: 10s | |
| retries: 3 | |
| start_period: 30s | |
| # βββ Nginx (production profile only) ββββββββββββββββββββββββ | |
| nginx: | |
| image: nginx:1.25-alpine | |
| container_name: bankbot_nginx | |
| restart: unless-stopped | |
| ports: | |
| - "80:80" | |
| - "443:443" | |
| volumes: | |
| - ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro | |
| - nginx_logs:/var/log/nginx | |
| depends_on: | |
| - frontend | |
| - backend | |
| profiles: | |
| - production | |
| healthcheck: | |
| test: ["CMD", "nginx", "-t"] | |
| interval: 30s | |
| timeout: 5s | |
| retries: 3 | |
| volumes: | |
| pgdata: | |
| driver: local | |
| redisdata: | |
| driver: local | |
| nginx_logs: | |
| driver: local | |