services:
  app:
    build: .
    env_file: .env
    volumes: [".:/var/www/html"]
    depends_on: [mysql, redis]
  nginx:
    image: nginx:1.27-alpine
    ports: ["8080:80"]
    volumes: [".:/var/www/html", "./docker/nginx.conf:/etc/nginx/conf.d/default.conf:ro"]
    depends_on: [app]
  mysql:
    image: mysql:8.4
    environment: {MYSQL_DATABASE: payments, MYSQL_USER: payments, MYSQL_PASSWORD: secret, MYSQL_ROOT_PASSWORD: root}
    ports: ["3307:3306"]
    volumes: ["mysql-data:/var/lib/mysql"]
  redis:
    image: redis:7.4-alpine
    ports: ["6380:6379"]
  horizon:
    build: .
    command: php artisan horizon
    env_file: .env
    volumes: [".:/var/www/html"]
    depends_on: [mysql, redis]
  scheduler:
    build: .
    command: php artisan schedule:work
    env_file: .env
    volumes: [".:/var/www/html"]
    depends_on: [mysql, redis]
volumes: {mysql-data: {}}
