services:
  app:
    build:
      context: .
      dockerfile: docker/Dockerfile
    container_name: starline-app
    depends_on:
      db:
        condition: service_healthy
    ports:
      - "8080:80"
    volumes:
      - .:/var/www/html
    working_dir: /var/www/html

  db:
    image: mysql:8.4
    container_name: starline-db
    environment:
      MYSQL_DATABASE: starline_erp
      MYSQL_PASSWORD: starline
      MYSQL_ROOT_PASSWORD: root
      MYSQL_USER: starline
    healthcheck:
      test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-proot"]
      timeout: 5s
      interval: 5s
      retries: 20
    ports:
      - "33060:3306"
    volumes:
      - starline-db-data:/var/lib/mysql

volumes:
  starline-db-data:
