services:
  jahia:
    image: jahia/jahia-ee:8.2
    depends_on:
      postgres:
        condition: service_healthy
    ports:
      - 8080:8080
      - 9229:9229
    environment:
      DB_VENDOR: postgresql
      DB_URL: jdbc:postgresql://postgres:5432/jahia
      DB_USER: jahia
      DB_PASS: dbpassword
      JPDA: true
      EXECUTE_PROVISIONING_SCRIPT: "file:/mnt/jahia/provisioning.yml"
    volumes:
      - type: bind
        source: ./docker
        target: /mnt/jahia
    healthcheck:
      test: ["CMD", "curl", "http://localhost:8080/start"]
      interval: 5s
      timeout: 1s
      retries: 30

  postgres:
    image: postgres:16
    environment:
      POSTGRES_USER: jahia
      POSTGRES_PASSWORD: dbpassword
    healthcheck:
      test: ["CMD", "pg_isready", "-U", "jahia"]
      interval: 5s
      timeout: 1s
      retries: 30
