90 lines
2.6 KiB
YAML
90 lines
2.6 KiB
YAML
services:
|
|
db:
|
|
image: pgvector/pgvector:pg16
|
|
environment:
|
|
POSTGRES_DB: wisegrade
|
|
POSTGRES_USER: wisegrade
|
|
POSTGRES_PASSWORD: wisegrade
|
|
volumes:
|
|
- pgdata:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: [CMD-SHELL, "pg_isready -U wisegrade"]
|
|
interval: 5s
|
|
retries: 12
|
|
redis:
|
|
image: redis:7-alpine
|
|
test-db:
|
|
profiles: [test]
|
|
image: pgvector/pgvector:pg16
|
|
environment:
|
|
POSTGRES_DB: wisegrade_tests
|
|
POSTGRES_USER: wisegrade_test
|
|
POSTGRES_PASSWORD: wisegrade_test
|
|
tmpfs:
|
|
- /var/lib/postgresql/data
|
|
healthcheck:
|
|
test: [CMD-SHELL, "pg_isready -U wisegrade_test -d wisegrade_tests"]
|
|
interval: 5s
|
|
retries: 12
|
|
test-redis:
|
|
profiles: [test]
|
|
image: redis:7-alpine
|
|
test:
|
|
profiles: [test]
|
|
build:
|
|
context: ./backend
|
|
args:
|
|
INCLUDE_DEV: "true"
|
|
env_file: .env
|
|
environment:
|
|
DATABASE_URL: postgresql+psycopg://wisegrade_test:wisegrade_test@test-db:5432/wisegrade_tests
|
|
TEST_DATABASE_URL: postgresql+psycopg://wisegrade_test:wisegrade_test@test-db:5432/wisegrade_tests
|
|
REDIS_URL: redis://test-redis:6379/0
|
|
EMBEDDING_MODEL_PATH: /models/bge-m3
|
|
OCR_MODEL_DIR: /models/ocr
|
|
volumes:
|
|
- ./backend/tests:/app/tests:ro
|
|
- ./docs:/docs:ro
|
|
- ./models:/models:ro
|
|
depends_on:
|
|
test-db: {condition: service_healthy}
|
|
test-redis: {condition: service_started}
|
|
command: ["pytest", "-q"]
|
|
api:
|
|
build: ./backend
|
|
env_file: .env
|
|
volumes: &api-volumes
|
|
- ${WISEGRADE_DATA_DIR}:/data/inbox:ro
|
|
- ./data/processed:/data/processed
|
|
- ./data/exports:/data/exports
|
|
- ./models:/models:ro
|
|
- ./docs:/app/course-docs:ro
|
|
depends_on:
|
|
db: {condition: service_healthy}
|
|
redis: {condition: service_started}
|
|
command: ["sh", "-c", "alembic upgrade head && uvicorn wisegrade.main:app --host 0.0.0.0 --port 8000"]
|
|
healthcheck:
|
|
test: [CMD, python, -c, "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/api/health')"]
|
|
interval: 10s
|
|
retries: 12
|
|
worker:
|
|
build: ./backend
|
|
restart: unless-stopped
|
|
env_file: .env
|
|
volumes: *api-volumes
|
|
depends_on:
|
|
db: {condition: service_healthy}
|
|
redis: {condition: service_started}
|
|
command: ["sh", "-c", "rq worker wisegrade --url \"$$REDIS_URL\""]
|
|
web:
|
|
build: ./frontend
|
|
ports:
|
|
- "127.0.0.1:${WISEGRADE_WEB_PORT:-18080}:80"
|
|
depends_on: [api]
|
|
healthcheck:
|
|
test: [CMD, wget, -q, -O, /dev/null, "http://127.0.0.1/health"]
|
|
interval: 10s
|
|
retries: 6
|
|
volumes:
|
|
pgdata:
|