# Full stack — Vultr / Oracle / local Docker Compose
services:
  api:
    build:
      context: ./backend
      dockerfile: Dockerfile
    restart: unless-stopped
    env_file:
      - .env
    environment:
      HOST: 0.0.0.0
      PORT: 8080
      RUNTIME: bun
      DB_FILE_PATH: /data/zendo-store.json
      DATABASE_URL: postgresql://zendo:${POSTGRES_PASSWORD:-zendo}@postgres:5432/zendo
    volumes:
      - zendo_app_data:/data
    depends_on:
      postgres:
        condition: service_healthy

  web:
    build:
      context: .
      dockerfile: web/Dockerfile
    restart: unless-stopped
    ports:
      - "${PUBLIC_PORT:-8080}:8080"
    depends_on:
      - api

  postgres:
    image: postgres:16-alpine
    restart: unless-stopped
    environment:
      POSTGRES_USER: zendo
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-change-me-in-production}
      POSTGRES_DB: zendo
    volumes:
      - zendo_postgres_data:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U zendo -d zendo"]
      interval: 10s
      timeout: 5s
      retries: 10

volumes:
  zendo_app_data:
  zendo_postgres_data:
