version: '3.8'

services:
  web:
    container_name: laravel-web
    image: app-name:latest
    build:
      target: web
      context: .
    env_file:
      - .env
    ports:
      - "8000:80"
    volumes:
      - .:/var/www/html
    depends_on:
      - db
  
  db:
    container_name: laravel-mysql
    platform: "linux/amd64"
    image: mysql:5.7
    env_file:
      - .env
    environment:
      MYSQL_ROOT_PASSWORD: root
      MYSQL_DATABASE: ${DB_DATABASE}
      MYSQL_USER: ${DB_USERNAME}
      MYSQL_PASSWORD: ${DB_PASSWORD}
    ports:
      - "3306:3306"
    volumes:
      - dbdata:/var/lib/mysql

volumes:
  dbdata: