version: '3'
services:
  app:
    build:
      context: ./docker/
      dockerfile: Dockerfile
    image: localpro/laravel
    container_name: localpro_app
    restart: always
    tty: true
    environment:
      SERVICE_NAME: app
      SERVICE_TAGS: dev
      PHP_IDE_CONFIG: serverName=localpro_app
    working_dir: /var/www/html
    volumes:
      - ./:/var/www/html
    networks:
      - mynet
    depends_on:
      - db
  nginx:
    image: nginx:alpine
    container_name: localpro_nginx
    restart: always
    tty: true
    ports:
      - '${APP_PORT:-89}:89' # Set any free port for local but also change nginx.conf
    volumes:
      - ./:/var/www/html
      - ./docker/nginx/conf.d/:/etc/nginx/conf.d/
    networks:
      - mynet
  db:
    image: mysql:8.0.25
    container_name: localpro_db_new
    command: --default-authentication-plugin=mysql_native_password
    restart: unless-stopped
    environment:
      MYSQL_DATABASE: ${DB_DATABASE}
      MYSQL_USER: ${DB_USERNAME}
      MYSQL_PASSWORD: ${DB_PASSWORD}
      MYSQL_ROOT_PASSWORD: ${DB_PASSWORD}
    volumes:
      - localpro_db:/var/lib/mysql
    ports:
      - '${FORWARD_DB_PORT:-3309}:3306' # Set any free port for local
    networks:
      - mynet

volumes:
  localpro_db:

networks:
  mynet:
    driver: bridge
