version: '3.8'
services:
  app:
    build:
      context: .
      dockerfile: Dockerfile
    image: ecoscan-app
    container_name: ecoscan-app
    restart: unless-stopped
    working_dir: /var/www
    volumes:
      - ./:/var/www
    depends_on:
      - db
    networks:
      - ecoscan-network

  web:
    image: nginx:alpine
    container_name: ecoscan-web
    restart: unless-stopped
    ports:
      - "8000:80"
    volumes:
      - ./:/var/www
      - ./docker/nginx/conf.d:/etc/nginx/conf.d
    depends_on:
      - app
    networks:
      - ecoscan-network

  db:
    image: mysql:8.0
    container_name: ecoscan-db
    restart: unless-stopped
    environment:
      MYSQL_DATABASE: ${DB_DATABASE}
      MYSQL_ROOT_PASSWORD: ${DB_PASSWORD}
      #MYSQL_PASSWORD: ${DB_PASSWORD}
      #MYSQL_USER: ${DB_USERNAME}
    volumes:
      - dbdata:/var/lib/mysql
    ports:
      - "3307:3306"
    networks:
      - ecoscan-network

networks:
  ecoscan-network:
    driver: bridge

volumes:
  dbdata:
    driver: local
