version: '3.8'

services:
  postgres-dev:
    image: postgres:15-alpine
    container_name: unionflow-postgres-dev
    environment:
      POSTGRES_DB: unionflow_dev
      POSTGRES_USER: unionflow_dev
      POSTGRES_PASSWORD: dev123
      POSTGRES_INITDB_ARGS: "--encoding=UTF-8 --lc-collate=C --lc-ctype=C"
    ports:
      - "5432:5432"
    volumes:
      - postgres_dev_data:/var/lib/postgresql/data
      - ./src/main/resources/db/init:/docker-entrypoint-initdb.d
    networks:
      - unionflow-dev
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U unionflow_dev -d unionflow_dev"]
      interval: 10s
      timeout: 5s
      retries: 5
    restart: unless-stopped

  adminer:
    image: adminer:4.8.1
    container_name: unionflow-adminer
    ports:
      - "8081:8080"
    networks:
      - unionflow-dev
    depends_on:
      - postgres-dev
    restart: unless-stopped

volumes:
  postgres_dev_data:
    driver: local

networks:
  unionflow-dev:
    driver: bridge
