Spaces:
Sleeping
Sleeping
| # docker-compose.yml | |
| # Menjalankan: docker compose up -d | |
| # Stop: docker compose down | |
| # Logs: docker compose logs -f backend | |
| version: "3.9" | |
| services: | |
| # ββ Redis (cache) ββββββββββββββββββββββββββββββββββββββ | |
| redis: | |
| image: redis:7.2-alpine | |
| container_name: sahamsense_redis | |
| restart: unless-stopped | |
| command: redis-server --maxmemory 256mb --maxmemory-policy allkeys-lru | |
| ports: | |
| - "6379:6379" | |
| volumes: | |
| - redis_data:/data | |
| healthcheck: | |
| test: ["CMD", "redis-cli", "ping"] | |
| interval: 10s | |
| timeout: 5s | |
| retries: 3 | |
| # ββ Backend FastAPI ββββββββββββββββββββββββββββββββββββ | |
| backend: | |
| build: | |
| context: ./backend | |
| dockerfile: Dockerfile | |
| container_name: sahamsense_backend | |
| restart: unless-stopped | |
| env_file: | |
| - ./backend/.env | |
| environment: | |
| - REDIS_URL=redis://redis:6379/0 | |
| - USE_REDIS=true | |
| ports: | |
| - "8000:8000" | |
| volumes: | |
| - ./backend/logs:/app/logs | |
| depends_on: | |
| redis: | |
| condition: service_healthy | |
| healthcheck: | |
| test: ["CMD", "python", "-c", | |
| "import httpx; r=httpx.get('http://localhost:8000/api/health', timeout=5); r.raise_for_status()"] | |
| interval: 30s | |
| timeout: 10s | |
| start_period: 20s | |
| retries: 3 | |
| # ββ Nginx reverse proxy (opsional, untuk production) ββ | |
| # nginx: | |
| # image: nginx:alpine | |
| # container_name: sahamsense_nginx | |
| # restart: unless-stopped | |
| # ports: | |
| # - "80:80" | |
| # - "443:443" | |
| # volumes: | |
| # - ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro | |
| # - ./nginx/ssl:/etc/nginx/ssl:ro | |
| # depends_on: | |
| # - backend | |
| volumes: | |
| redis_data: | |
| driver: local | |
| networks: | |
| default: | |
| name: sahamsense_network |