services:
  postgres:
    image: postgres:15
    container_name: postgres
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: "postgres"
      POSTGRES_DB: postgres
    healthcheck:
      test: [ "CMD-SHELL", "pg_isready -U $$POSTGRES_USER" ]
      interval: 10s
      timeout: 5s
      retries: 5
    volumes:
      - postgres:/var/lib/postgresql/data
      - ./docker/postgres/:/docker-entrypoint-initdb.d/
    ports:
      - "5432:5432"

  camunda:
    build: .
    image: romanowalex/camunda-base:v2.0
    container_name: camunda
    environment:
      SPRING_PROFILES_ACTIVE: docker
    healthcheck:
      test: [ "CMD", "curl", "--silent", "--fail", "http://localhost:8080/manage/health" ]
      interval: 20s
      timeout: 10s
      retries: 10
    ports:
      - "8080:8080"
    depends_on:
      postgres:
        condition: service_healthy

volumes:
  postgres:
