services:
  app:
    build: .
    ports: ['8000:8000']
    env_file: .env
    depends_on: [mysql, redis]
  worker:
    build: .
    command: php artisan queue:work redis --tries=3 --timeout=90
    env_file: .env
    depends_on: [mysql, redis]
  horizon:
    build: .
    command: php artisan horizon
    env_file: .env
    depends_on: [mysql, redis]
  gateway:
    build: ./gateway
    env_file: ./gateway/.env
    volumes: [./gateway/storage:/gateway/storage]
    depends_on: [app]
  mysql:
    image: mysql:8.4
    environment: { MYSQL_DATABASE: whatsapp_hub, MYSQL_USER: whatsapp, MYSQL_PASSWORD: secret, MYSQL_ROOT_PASSWORD: root }
    ports: ['3306:3306']
    volumes: [mysql-data:/var/lib/mysql, ./docker/mysql/init.sql:/docker-entrypoint-initdb.d/01-testing.sql:ro]
  redis:
    image: redis:7-alpine
    ports: ['6379:6379']
volumes: { mysql-data: }
