version: "3"
services:
  #PHP Service
  app:
    build:
      context: .
      dockerfile: Dockerfile
    # image: php:v2
    container_name: hospitalmanager-dev-app
    restart: unless-stopped
    tty: true
    #    expose:
    #      - 9000
    environment:
      SERVICE_NAME: app
      SERVICE_TAGS: dev
    working_dir: /var/www
    volumes:
      - ./:/var/www
      - ./docker/php/conf/local.ini:/usr/local/etc/php/conf.d/local.ini
      - ./docker/php/conf/error_reporting.ini:/usr/local/etc/php/conf.d/error_reporting.ini
      - ./docker/php/conf/xdebug.ini:/usr/local/etc/php/conf.d/xdebug.ini
    networks:
      - hospitalmanager-dev-network

  #Nginx Service
  webserver:
    image: nginx:1.15-alpine
    container_name: hospitalmanager-dev-webserver
    restart: unless-stopped
    tty: true
    environment:
      - VIRTUAL_HOST=hospitalmanager.local
    #      - VIRTUAL_HOST=example.test # Environment variable needed for nginx proxy
    #      - LETSENCRYPT_HOST=example.test # Environment variables needed for Let's Encrypt companion
    #      - LETSENCRYPT_EMAIL=admin@example.test
    ports:
      - "50053:80"
    expose:
      - "80"
    volumes:
      - ./:/var/www
      - ./docker/nginx/conf.d/:/etc/nginx/conf.d/
    networks:
      - hospitalmanager-dev-network
  #    depends_on:
  #      - app
  #      - db

  #MySQL Service
  db:
    image: mysql:8.0.33
    platform: linux/amd64
    container_name: hospitalmanager-dev-db
    restart: unless-stopped
    tty: true
    ports:
      - "33102:3306"
    environment:
      MYSQL_ROOT_PASSWORD: 2#9@29qeQA@h
      MYSQL_DATABASE: hospitalmanager
      MYSQL_USER: dpg23hc
      MYSQL_PASSWORD: 2#9@29qeQA@h
      SERVICE_TAGS: dev
      SERVICE_NAME: mysql
    volumes:
      - dbdata:/var/lib/mysql/
      - ./docker/mysql/my.cnf:/etc/mysql/my.cnf
    networks:
      - hospitalmanager-dev-network
  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    restart: unless-stopped
    container_name: hospitalmanager-dev-phpmyadmin
    ports:
      - 33352:80
    links:
      - db
    environment:
      PMA_HOST: db
      UPLOAD_LIMIT: 102400K

    networks:
      - hospitalmanager-dev-network
#Docker Networks
networks:
  hospitalmanager-dev-network:
    external:
      name: proxy_nginx-proxy # Reference our network that was created by Docker Compose when we launched our two main containers earlier. Name generated automatically. Use `docker network ls` to list all networks and their names.
#  nginx-proxy:
#Volumes
volumes:
  dbdata:
    driver: local
