
services:
  web:
    build: .
    ports:
      - "5000:5000"
    volumes:
      - .:/app
    env_file:
      - .env
    environment:
      - DB_HOST=db
      - DB_USER=root
      - DB_PASSWORD=rootpassword
      - DB_NAME=gardibas_xt_dev_84943
    depends_on:
      - db

  db:
    image: mariadb:11.4
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: rootpassword
      MYSQL_DATABASE: gardibas_xt_dev_84943
    ports:
      - "3306:3306"
    volumes:
      - db_data:/var/lib/mysql
      - ./db_init:/docker-entrypoint-initdb.d
    healthcheck:
      test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
      interval: 10s
      timeout: 5s
      retries: 3

  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    ports:
      - "8080:80"
    environment:
      - PMA_HOST=db
      - MYSQL_ROOT_PASSWORD=rootpassword
    depends_on:
      - db

volumes:
  db_data: