services:
  app:
    image: abdelazizbarhoumi/dtr-app:latest
    container_name: dtr-app
    ports:
      - "${APP_PORT:-8000}:8000"
    volumes:
      - laravel_storage:/var/www/html/storage
      - laravel_cache:/var/www/html/bootstrap/cache
    depends_on:
      - db
    command: php artisan octane:start --server=swoole --host=0.0.0.0 --port=8000
    environment:
      APP_KEY: base64:6dB71CXToeeY4FkgL3eOv+tE5EHX3SprrXKwIon8QIE=
      GEMINI_API_KEY: AIzaSyAhsblvQMZOgGyQO-MiDNB_XfJts9i2tgg
      DB_CONNECTION: mysql
      DB_HOST: db
      DB_PORT: 3306
      DB_DATABASE: DTR
      DB_USERNAME: dtr
      DB_PASSWORD: secret
      APP_URL: "${APP_URL:-http://localhost:8000}"
    healthcheck:
      test: ["CMD-SHELL", "wget -qO- http://127.0.0.1:8000 || exit 1"]
      interval: 30s
      timeout: 5s
      retries: 3
  

  db:
    image: mysql:8.0
    container_name: dtr_db
    environment:
      MYSQL_DATABASE: DTR
      MYSQL_USER: dtr
      MYSQL_PASSWORD: secret
      MYSQL_ROOT_PASSWORD: rootpassword
      PHP_OPCACHE_ENABLE: 1
    ports:
      - "3306:3306"
    volumes:
      - dbdata:/var/lib/mysql

volumes:
  dbdata:
  laravel_storage:
  laravel_cache:
