version: '2'
services:
  app:
    build: .
    ports:
      - "8000:8000"
    volumes:
      - .:/app
    env_file: .env
    working_dir: /app
    command: bash -c 'php artisan migrate && php artisan serve --host 0.0.0.0'
    depends_on:
      - mysql
    links:
      - mysql
  mysql:
    build:
      context: ./docker/mysql
      args:
        - MYSQL_VERSION=5.6
    environment:
      - MYSQL_DATABASE=default
      - MYSQL_USER=default
      - MYSQL_PASSWORD=secret
      - MYSQL_ROOT_PASSWORD=root
      - TZ=UTC
    volumes:
      - ./data/mysql:/var/lib/mysql
      - ./docker/mysql/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d
    ports:
      - "3306:3306"

  phpmyadmin:
    depends_on:
      - mysql
    image: phpmyadmin/phpmyadmin
    restart: always
    ports:
      - 8090:80
    environment:
      PMA_HOST: mysql
      MYSQL_ROOT_PASSWORD: root