services:
  app:
    build: {context: ., dockerfile: docker/php.Dockerfile}
    env_file: .env
    depends_on: [mysql, redis]
    command: php-fpm
  nginx:
    image: nginx:1.27-alpine
    ports: ["8080:80"]
    volumes:
      - ./:/var/www/html:ro
      - ./nginx/default.conf:/etc/nginx/conf.d/default.conf:ro
    depends_on: [app]
  horizon:
    build: {context: ., dockerfile: docker/php.Dockerfile}
    env_file: .env
    command: php artisan horizon
    depends_on: [mysql, redis]
  scheduler:
    build: {context: ., dockerfile: docker/php.Dockerfile}
    env_file: .env
    command: php artisan schedule:work
    depends_on: [mysql, redis]
  mysql:
    image: mysql:8.4
    environment:
      MYSQL_DATABASE: gateway
      MYSQL_USER: gateway
      MYSQL_PASSWORD: local-only-change-me
      MYSQL_ROOT_PASSWORD: local-root-change-me
    command: --character-set-server=utf8mb4 --collation-server=utf8mb4_0900_ai_ci
    volumes: ["mysql_data:/var/lib/mysql"]
  redis:
    image: redis:7.4-alpine
    command: redis-server --appendonly yes --requirepass local-only-change-me
    volumes: ["redis_data:/data"]
volumes: {mysql_data: {}, redis_data: {}}
