services:
  app:
    build:
      context: .
      dockerfile: Dockerfile
    image: tranquil-pds
    ports:
      - "3000:3000"
    environment:
      DATABASE_URL: postgres://postgres:postgres@db:5432/pds
    volumes:
      - ./config.toml:/etc/tranquil-pds/config.toml:ro
      - blob_data:/var/lib/tranquil/blobs
    depends_on:
      - db

  frontend:
    build:
      context: ./frontend
      dockerfile: Dockerfile
    image: tranquil-pds-frontend
    ports:
      - "8080:80"
    depends_on:
      - app

  db:
    image: postgres:18-alpine
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgres
      POSTGRES_DB: pds
    ports:
      - "5432:5432"
    volumes:
      - postgres_data:/var/lib/postgresql

  prometheus:
    image: prom/prometheus:v3.8.0
    ports:
      - "9090:9090"
    volumes:
      - ./observability/prometheus.yaml:/etc/prometheus/prometheus.yaml:ro
      - prometheus_data:/prometheus
    command:
      - '--config.file=/etc/prometheus/prometheus.yaml'
      - '--storage.tsdb.path=/prometheus'
    depends_on:
      - app

volumes:
  postgres_data:
  blob_data:
  prometheus_data:
