services:
  app:
    depends_on:
      db:
        condition: service_healthy
    environment:
      APP_ENV: local
      APP_DEBUG: "true"
      APP_URL: "http://localhost:${APP_PORT:-8080}"
      DB_CONNECTION: mysql
      DB_HOST: db
      DB_PORT: "3306"
      DB_DATABASE: pharking
      DB_USERNAME: pharking
      DB_PASSWORD: pharking
      DB_URL: ""
      MYSQL_URL: ""
      PGSQL_URL: ""
      LARAVEL_CHMOD_MODE: "0777"
      LARAVEL_CLEAR_CONFIG_CACHE: "1"
    volumes:
      - .:/var/www/html

  db:
    image: mysql:8.0
    restart: unless-stopped
    command:
      - --character-set-server=utf8mb4
      - --collation-server=utf8mb4_unicode_ci
    environment:
      MYSQL_DATABASE: pharking
      MYSQL_USER: pharking
      MYSQL_PASSWORD: pharking
      MYSQL_ROOT_PASSWORD: root
    volumes:
      - pharking-db-data:/var/lib/mysql
    healthcheck:
      test: ["CMD-SHELL", "mysqladmin ping -h 127.0.0.1 -uroot -p$$MYSQL_ROOT_PASSWORD --silent"]
      interval: 5s
      timeout: 5s
      retries: 20
      start_period: 20s

volumes:
  pharking-db-data:
