version: '3'
services:

  #Laravel App
  app:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: app.fiza.ir
    restart: unless-stopped
    tty: true
    environment:
      SERVICE_NAME: app
      SERVICE_TAGS: dev
    working_dir: /var/www/html
    volumes:
      - ./:/var/www/html
    networks:
      - mynet

  #Nginx Service
  nginx:
    image: nginx:alpine
    container_name: nginx
    restart: unless-stopped
    tty: true
    ports:
      - "8000:80"
    volumes:
      - ./:/var/www/html
      - ./nginx/conf/:/etc/nginx/conf.d/
    networks:
      - mynet

  #MySQL Service
  db:
    image: mysql:5.7
    container_name: db
    restart: unless-stopped
    tty: true
    ports:
      - "3308:3306"
    environment:
      MYSQL_DATABASE: fiza_app
      MYSQL_USER: fiza_app
      MYSQL_PASSWORD: fiza_app
      MYSQL_ROOT_PASSWORD: fiza_app

    volumes:
      - mysqldata:/var/lib/mysql/
      - ./fiza_app.sql:/docker-entrypoint-initdb.d/dump.sql
    networks:
      - mynet

#Docker Networks
networks:
  mynet:
    driver: bridge
#Volumes
volumes:
  mysqldata:
    driver: local