82 lines
2.2 KiB
YAML
82 lines
2.2 KiB
YAML
# Local skeleton and production stack.
|
|
# Local default: 127.0.0.1:8000. Production on the Pi: 0.0.0.0:8006 via .env.
|
|
# Host path on the server: ~/docker/buyingagent
|
|
|
|
services:
|
|
postgres:
|
|
image: postgres:17-alpine
|
|
container_name: buyingagent-db-prod
|
|
environment:
|
|
POSTGRES_DB: "${DB_NAME:-buyingagent}"
|
|
POSTGRES_USER: "${DB_USER:-buyingagent}"
|
|
POSTGRES_PASSWORD: "${DB_PASSWORD:-change_me}"
|
|
volumes:
|
|
- buyingagent-db-data:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-buyingagent} -d ${DB_NAME:-buyingagent}"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 10
|
|
restart: unless-stopped
|
|
networks:
|
|
- buyingagent-network
|
|
|
|
api:
|
|
build:
|
|
context: ./backend
|
|
dockerfile: Dockerfile
|
|
target: runtime
|
|
container_name: buyingagent-api
|
|
environment:
|
|
DB_HOST: postgres
|
|
DB_PORT: "5432"
|
|
DB_NAME: "${DB_NAME:-buyingagent}"
|
|
DB_USER: "${DB_USER:-buyingagent}"
|
|
DB_PASSWORD: "${DB_PASSWORD:-change_me}"
|
|
ENVIRONMENT: "${ENVIRONMENT:-production}"
|
|
ENGINE_BUILD: "${ENGINE_BUILD:-dev}"
|
|
CORS_ALLOWED_ORIGINS: "${CORS_ALLOWED_ORIGINS:-http://localhost:4173,http://127.0.0.1:4173}"
|
|
ports:
|
|
- "${BUYING_AGENT_API_BIND:-127.0.0.1}:${BUYING_AGENT_API_PORT:-8000}:8000"
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
healthcheck:
|
|
test:
|
|
[
|
|
"CMD",
|
|
"python",
|
|
"-c",
|
|
"import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/health/ready')",
|
|
]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 12
|
|
start_period: 60s
|
|
restart: unless-stopped
|
|
networks:
|
|
- buyingagent-network
|
|
|
|
frontend:
|
|
build:
|
|
context: ./frontend
|
|
dockerfile: Dockerfile
|
|
container_name: buyingagent-frontend
|
|
environment:
|
|
API_PROXY_TARGET: http://api:8000
|
|
ports:
|
|
- "${BUYING_AGENT_FRONTEND_BIND:-127.0.0.1}:${BUYING_AGENT_FRONTEND_PORT:-4173}:80"
|
|
depends_on:
|
|
api:
|
|
condition: service_healthy
|
|
restart: unless-stopped
|
|
networks:
|
|
- buyingagent-network
|
|
|
|
volumes:
|
|
buyingagent-db-data:
|
|
|
|
networks:
|
|
buyingagent-network:
|
|
driver: bridge
|