version: '3.8'
services:
  app:
    build:
      context: .
      dockerfile: Dockerfile
    volumes:
      - .:/var/www/html
      - ./vendor:/var/www/html/vendor
      - ./node_modules:/var/www/html/node_modules
    ports:
      - "9000:9000"
    depends_on:
      - db
    environment:
      - APP_NAME=${APP_NAME}
      - APP_ENV=local
      - APP_KEY=${APP_KEY}
      - APP_DEBUG=true
      - APP_URL=${APP_URL}
      - DB_HOST=${DB_HOST}
      - DB_PORT=${DB_PORT}
      - DB_DATABASE=${DB_DATABASE}
      - DB_USERNAME=${DB_USERNAME}
      - DB_PASSWORD=${DB_PASSWORD}

  db:
    image: mysql:5.7
    environment:
      MYSQL_ROOT_PASSWORD: secret
      MYSQL_DATABASE: laravel
    volumes:
      - db_data:/var/lib/mysql
    ports:
      - "3307:3306"

  nginx:
    image: nginx:alpine
    ports:
      - "80:80"
    volumes:
      - .:/var/www/html
      - ./nginx.conf:/etc/nginx/nginx.conf
    depends_on:
      - app

volumes:
  db_data:
