services:
  php:
    build:
      context: ./
      dockerfile: docker/php/Dockerfile
      args:
        - PHP_VERSION=${PHP_VERSION:-8.3.19}
    volumes:
      - ./:/var/www/html
    depends_on:
      - postgresql

  postgresql:
    build:
      context: ./
      dockerfile: docker/databases/postgresql/Dockerfile
      args:
        - VERSION=${VERSION:-17.4}
        - ALPINE_VERSION=${ALPINE_VERSION:-3.21}
    ports:
      - "5432:5432"
    volumes:
      - ./test/integration/TestFixtures/pgsql.sql:/docker-entrypoint-initdb.d/pgsql.sql
    environment:
      - POSTGRES_DB=${POSTGRES_DB:-laminasdb_test}
      - POSTGRES_USER=${POSTGRES_USER:-postgres}
      - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-postgres}
    healthcheck:
      test: ["CMD-SHELL", "sh -c 'pg_isready -U ${POSTGRES_USER:-postgres} -d ${POSTGRES_DB:-laminasdb_test}'"]
      interval: 30s
      timeout: 60s
      retries: 5
      start_period: 80s