Barclays-banner-builder/docker-compose.prod.yml
Vadym Samoilenko 942742181b Mount rag-corpus/ into api and worker containers
ingest_rag.py resolves path as /rag-corpus (3 levels up from /app/scripts/).
Without the mount the container sees an empty /rag-corpus directory.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-17 12:22:03 +01:00

96 lines
2.3 KiB
YAML

services:
postgres:
image: pgvector/pgvector:pg16
restart: always
environment:
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
volumes:
- postgres_data:/var/lib/postgresql/data
networks:
- internal
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER}"]
interval: 10s
timeout: 5s
retries: 10
redis:
image: redis:7-alpine
restart: always
volumes:
- redis_data:/data
networks:
- internal
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 3s
retries: 10
api:
build:
context: ./backend
target: prod
restart: always
command: >
uvicorn app.main:app
--host 0.0.0.0
--port 8000
--workers 2
--proxy-headers
--forwarded-allow-ips='*'
env_file: .env
environment:
- DATABASE_URL=postgresql+asyncpg://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}
- REDIS_URL=redis://redis:6379/0
volumes:
- ./backend:/app
- ./assets:/assets:ro
- ./rag-corpus:/rag-corpus:ro
- pdf_artifacts:/artifacts
networks:
- internal
ports:
# Apache proxies 127.0.0.1:8010 → this container (port 8000 is occupied on this host)
- "127.0.0.1:8010:8000"
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
worker:
build:
context: ./backend
target: prod
restart: always
command: rq worker --with-scheduler --url redis://redis:6379/0 banners
env_file: .env
environment:
- DATABASE_URL=postgresql+asyncpg://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}
- REDIS_URL=redis://redis:6379/0
volumes:
- ./backend:/app
- ./assets:/assets:ro
- ./rag-corpus:/rag-corpus:ro
- pdf_artifacts:/artifacts
networks:
- internal
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
# NOTE: No 'web' (Nginx) service — Apache serves the React SPA directly
# from /var/www/html/barclays-banner-builder/ (managed by deploy.sh)
networks:
internal:
volumes:
postgres_data:
redis_data:
pdf_artifacts: