72 lines
1.6 KiB
YAML
72 lines
1.6 KiB
YAML
version: '3.8'
|
|
|
|
services:
|
|
# 1. FastAPI Backend
|
|
backend:
|
|
build:
|
|
context: ./backend
|
|
ports:
|
|
- "8000:8000"
|
|
env_file:
|
|
- ./backend/.env
|
|
environment:
|
|
- DATABASE_URL=postgresql+asyncpg://irt_user:dev_password@postgres:5432/irt_bank_soal
|
|
- REDIS_URL=redis://redis:6379/0
|
|
depends_on:
|
|
- postgres
|
|
- redis
|
|
restart: unless-stopped
|
|
|
|
# 2. Redis Message Broker (Required by Celery)
|
|
redis:
|
|
image: redis:7-alpine
|
|
ports:
|
|
- "6380:6379"
|
|
restart: unless-stopped
|
|
volumes:
|
|
- redis_data:/data
|
|
|
|
# 2.5 PostgreSQL Database
|
|
postgres:
|
|
image: postgres:15-alpine
|
|
environment:
|
|
POSTGRES_USER: irt_user
|
|
POSTGRES_PASSWORD: dev_password
|
|
POSTGRES_DB: irt_bank_soal
|
|
ports:
|
|
- "5433:5432"
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
restart: unless-stopped
|
|
|
|
# 3. Celery Worker (For AI Generation Background Tasks)
|
|
celery_worker:
|
|
build:
|
|
context: ./backend
|
|
command: ["celery", "-A", "app.core.celery_app", "worker", "--loglevel=info"]
|
|
env_file:
|
|
- ./backend/.env
|
|
environment:
|
|
- DATABASE_URL=postgresql+asyncpg://irt_user:dev_password@postgres:5432/irt_bank_soal
|
|
- REDIS_URL=redis://redis:6379/0
|
|
depends_on:
|
|
- backend
|
|
- redis
|
|
restart: unless-stopped
|
|
|
|
# 4. React Frontend SPA
|
|
frontend:
|
|
build:
|
|
context: ./frontend
|
|
args:
|
|
VITE_API_URL: "http://localhost:8000/api/v1"
|
|
ports:
|
|
- "3000:80"
|
|
depends_on:
|
|
- backend
|
|
restart: unless-stopped
|
|
|
|
volumes:
|
|
postgres_data:
|
|
redis_data:
|