version: '3'
services:

  #PHP Service
  app_zazi:
    build:
      context: .
      dockerfile: Dockerfile
    image: 8.1-fpm
    container_name: app_zazi
    restart: unless-stopped
    tty: true
    environment:
      SERVICE_NAME: app_zazi
      SERVICE_TAGS: dev
    working_dir: /var/www
    volumes:
      - .:/var/www
      - ./docker/php/local.ini:/usr/local/etc/php/conf.d/local.ini
    networks:
      - app-network

  #Nginx Service
  webserver_zazi:
    image: nginx:alpine
    container_name: webserver_zazi
    restart: unless-stopped
    tty: true
    ports:
      - "8084:80"
      - "447:443"
    volumes:
      - .:/var/www
      - ./docker/nginx/conf.d/:/etc/nginx/conf.d/
    networks:
      - app-network

  #MySQL Service
  db_zazi:
    image: mysql:5.7.22
    container_name: db_zazi
    restart: unless-stopped
    tty: true
    ports:
      - "3307:3306"
    environment:
      - MYSQL_DATABASE=homestead
      - MYSQL_ROOT_PASSWORD=secret
      - MYSQL_USER=homestead
      - MYSQL_PASSWORD=secret
      - MYSQL_ROOT_HOST=%
      - SERVICE_TAGS=dev
      - SERVICE_NAME=mysql
    volumes:
      - dbdata:/var/lib/mysql/
      #- ./docker/mysql/my.cnf:/etc/mysql/my.cnf
    networks:
      - app-network
  # phpmyadmin
  phpmyadmin:
    depends_on:
      - db_zazi
    image: phpmyadmin/phpmyadmin
    restart: always
    ports:
      - '8085:80'
    environment:
      PMA_HOST: db_zazi
      MYSQL_ROOT_PASSWORD: secret
    networks:
      - app-network
#Docker Networks
networks:
  app-network:
    driver: bridge
#Volumes
volumes:
  dbdata:
    driver: local
