version: "3"

services:
  app:
    build: .
    volumes:
      - type: bind
        source: ./src/
        target: /app/src
      - type: bind
        source: ./templates/
        target: /app/templates
      - type: bind
        source: ./assets/
        target: /app/assets
      - type: bind
        source: ./webpack.config.js
        target: /app/webpack.config.js
    ports:
      - "8000:8000"
    networks:
      - mysql-phpmyadmin
    extra_hosts:
      - host.docker.internal:host-gateway
    depends_on:
      - mysql

  # Database
  mysql:
    image: mysql:8.0
    container_name: project_mysql
    environment:
      MYSQL_ALLOW_EMPTY_PASSWORD: "true"
      MYSQL_ROOT_PASSWORD:
      MYSQL_DATABASE: wwtqmw_homolog
      MYSQL_USER: wwtqmw_homolog
      MYSQL_PASSWORD: project
    volumes:
      - ./.docker/db:/var/lib/mysql
    ports:
      - "3307:3306"
    networks:
      - mysql-phpmyadmin
    extra_hosts:
      - "host.docker.internal:host-gateway"

  # phpmyadmin
  phpmyadmin:
    depends_on:
      - mysql
    container_name: project_phpmyadmin
    image: phpmyadmin
    ports:
      - "8090:80"
    environment:
      PMA_HOST: mysql
      MYSQL_ROOT_PASSWORD: password
    networks:
      - mysql-phpmyadmin
    extra_hosts:
      - "host.docker.internal:host-gateway"

networks:
  mysql-phpmyadmin:
