version: '3.1'

services:
  web:
    build: .
    ports:
      - "8080:80"
    volumes:
      - .:/var/www/html
    depends_on:
      - db
    networks:
      - vistoria-network

  db:
    image: mysql:5.7
    environment:
      MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
      MYSQL_DATABASE: ${MYSQL_DATABASE}
      MYSQL_USER: ${MYSQL_USER}
      MYSQL_PASSWORD: ${MYSQL_PASSWORD}
    ports:
      - "3306:3306"
    volumes:
      - ./vistoria.sql:/docker-entrypoint-initdb.d/vistoria.sql
      - db_data:/var/lib/mysql
    networks:
      - vistoria-network

volumes:
  db_data:

networks:
  vistoria-network:
    driver: bridge
