services:
  db:
    image: postgres:16-alpine
    environment:
      POSTGRES_USER: cabinet
      POSTGRES_PASSWORD: cabinet
      POSTGRES_DB: cabinet
    volumes:
      - pgdata:/var/lib/postgresql/data
    ports:
      - "5432:5432"

  app:
    build:
      context: .
      dockerfile: backend/Dockerfile
    depends_on:
      - db
    environment:
      DATABASE_URL: postgresql+psycopg2://cabinet:cabinet@db:5432/cabinet
      SECRET_KEY: ${SECRET_KEY:-change-me}
      ADMIN_USERNAME: ${ADMIN_USERNAME:-operator}
      ADMIN_PASSWORD: ${ADMIN_PASSWORD:-change-me}
      ONEC_MODE: ${ONEC_MODE:-demo}
      GKH_BASE_URL: ${GKH_BASE_URL:-}
      GKH_USERNAME: ${GKH_USERNAME:-}
      GKH_PASSWORD: ${GKH_PASSWORD:-}
    ports:
      - "8000:8000"

volumes:
  pgdata:
