volumes:
  registry_data:
  postgres_data:
  dex_data:

services:
  postgres:
    image: postgres:18-alpine
    container_name: rise-postgres
    restart: unless-stopped
    ports:
      - "5432:5432"
    volumes:
      - postgres_data:/var/lib/postgresql/data
    environment:
      - POSTGRES_USER=${POSTGRES_USER:-rise}
      - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-rise123}
      - POSTGRES_DB=${POSTGRES_DB:-rise}
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U rise"]
      interval: 5s
      timeout: 5s
      retries: 5

  # OIDC provider for authentication in the development environment.
  dex:
    image: dexidp/dex:v2.45.1
    container_name: rise-dex
    restart: unless-stopped
    user: "0:0"
    ports:
      - "5556:5556"
    volumes:
      - ./dev/dex:/dex-config:ro
      - dex_data:/var/dex
    entrypoint: ["/usr/local/bin/dex"]
    command: ["serve", "/dex-config/config.yaml"]
    healthcheck:
      test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:5556/dex/healthz"]
      interval: 5s
      timeout: 5s
      retries: 5

  # Docker registry for images pushed by the rise CLI in the development environment.
  registry:
    image: registry:3
    container_name: rise-registry
    restart: unless-stopped
    ports:
      - "5000:5000"
    volumes:
      - registry_data:/var/lib/registry
    environment:
      - REGISTRY_STORAGE_DELETE_ENABLED=true

  # Helper UI to explore images pushed to the registry.
  registry-ui:
    image: quiq/registry-ui
    container_name: rise-registry-ui
    restart: unless-stopped
    ports:
      - "5001:5001"
    environment:
      - REGISTRY_HOSTNAME=rise-registry:5000
      - REGISTRY_INSECURE=true
      - PERFORMANCE_CATALOG_REFRESH_INTERVAL=0.1
      - TAGS_COUNT_REFRESH_INTERVAL=0.1
      - LISTEN_ADDR=0.0.0.0:5001
    depends_on:
      - registry
