volumes:
  shared:
services:
  phpdoc:
    image: phpdoc/phpdoc:3
    volumes:
      - ".:/data:ro"
      - "./docs/:/data/docs"
    command:
      - "--cache-folder=/tmp"
  beanstalk-unix:
    image: ghcr.io/sammousa/beanstalkd:latest
    entrypoint:
      - /usr/bin/beanstalkd
      - -l
      - unix:/shared/beanstalkd.sock
    volumes:
      - type: volume
        source: shared
        target: /shared
  beanstalk:
    image: ghcr.io/sammousa/beanstalkd:latest
  phpunit:
    build:
      context: ./dockerfiles
      dockerfile: Dockerfile-phpunit
      args:
        PHP_VERSION: "${PHP_VERSION:-8.3}"
    environment:
      SERVER_HOST: beanstalk
      UNIX_SERVER_HOST: unix:///shared/beanstalkd.sock
    depends_on:
      - beanstalk
      - beanstalk-unix
    volumes:
      - type: volume
        source: shared
        target: /shared
      - ./:/app:ro
      - ./.phpunit.cache:/app/.phpunit.cache:rw
      - ./tests/coverage:/coverage:rw
    command:
      - --coverage-clover
      - /coverage/coverage.xml
      - --coverage-html
      - /coverage
