services:
  app:
    build: .
    ports:
      - "8080:80"
    volumes:
      - sawaed_storage:/var/www/html/storage
    depends_on:
      db:
        condition: service_healthy
    restart: unless-stopped
  db:
    image: mysql:8.4
    environment:
      MYSQL_DATABASE: sawaed_erp
      MYSQL_USER: sawaed_user
      MYSQL_PASSWORD: change-this-before-production
      MYSQL_ROOT_PASSWORD: change-root-before-production
    volumes:
      - sawaed_mysql:/var/lib/mysql
    healthcheck:
      test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-pchange-root-before-production"]
      interval: 10s
      timeout: 5s
      retries: 10
    restart: unless-stopped
volumes:
  sawaed_mysql:
  sawaed_storage:
