# Development environment override
services:
  php:
    build:
      context: ./api
      target: php_dev
    volumes:
      - ./api:/srv/app
      - ./api/docker/php/conf.d/app.dev.ini:/usr/local/etc/php/conf.d/app.dev.ini:ro
      # If you develop on Mac or Windows you can remove the vendor/ directory
      #  from the bind-mount for better performance by enabling the next line:
      #- /srv/app/vendor
    environment:
      # See https://xdebug.org/docs/all_settings#mode
      XDEBUG_MODE: "${XDEBUG_MODE:-off}"
    extra_hosts:
      # Ensure that host.docker.internal is correctly defined on Linux
      - host.docker.internal:host-gateway

  front:
    build:
      context: ./front
      target: dev
    volumes:
      - ./front:/srv/app
    environment:
      API_PLATFORM_CREATE_CLIENT_ENTRYPOINT: http://caddy
      API_PLATFORM_CREATE_CLIENT_OUTPUT: .
      # On Linux, you may want to comment the following line for improved performance
      # WATCHPACK_POLLING: "true"

  caddy:
    command: [ "caddy", "run", "--config", "/etc/caddy/Caddyfile", "--watch" ]
    build:
      context: api/
      target: caddy_base
    volumes:
      - ./api/public:/srv/app/public:ro
      - ./api/docker/caddy/Caddyfile:/etc/caddy/Caddyfile:ro
    environment:
      MERCURE_EXTRA_DIRECTIVES: demo
    ports:
      # HTTP
      - target: 80
        published: ${HTTP_PORT:-8088}
        protocol: tcp


###> doctrine/doctrine-bundle ###
###< doctrine/doctrine-bundle ###

###> symfony/mercure-bundle ###
###< symfony/mercure-bundle ###