services:
  batik_app:
    build: .
    container_name: batik_app
    ports:
      - "8000:80"
    volumes:
      - .:/var/www/html
      - /var/www/html/vendor
    depends_on:
      batik_db:
        condition: service_healthy
    environment:
      - APP_ENV=local
      - APP_DEBUG=true
      - APP_URL=http://localhost:8000
      - DB_CONNECTION=mysql
      - DB_HOST=batik_db
      - DB_PORT=3306
      - DB_DATABASE=batik_catalog
      - DB_USERNAME=root
      - DB_PASSWORD=root
    restart: unless-stopped

  batik_db:
    image: mysql:8.0
    container_name: batik_db
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: root
      MYSQL_DATABASE: batik_catalog
    ports:
      - "3307:3306"
    volumes:
      - batik_db_data:/var/lib/mysql
    healthcheck:
      test: [ "CMD", "mysqladmin", "ping", "-h", "localhost", "-uroot", "-proot" ]
      interval: 5s
      timeout: 5s
      retries: 10

  batik_pma:
    image: phpmyadmin/phpmyadmin
    container_name: batik_pma
    ports:
      - "8080:80"
    environment:
      PMA_HOST: batik_db
      MYSQL_ROOT_PASSWORD: root
    depends_on:
      - batik_db

volumes:
  batik_db_data:
