#version: "3.7"
services:
  app:
    build:
      args:
        user: harsoftng
        uid: 1000
      context: ./
      dockerfile: Dockerfile
    image: jamb-byod
    container_name: jamb-byod-app
    restart: unless-stopped
    working_dir: /var/www/
    cpu_count: 25
    mem_limit: 120g
    depends_on:
      - jamb-db
    volumes:
      - ./:/var/www
      - ./docker/php.ini:/usr/local/etc/php/conf.d/php.ini
    networks:
      - jamb_byod_network
      - default

  jamb-db:
    image: mysql:8.0
    container_name: jamb-db
    cpu_count: 25
    mem_limit: 120g
    restart: unless-stopped
    environment:
      MYSQL_ALLOW_EMPTY_PASSWORD: false
      MYSQL_DATABASE: app_db
      MYSQL_USER: db_user
      MYSQL_PASSWORD: db_user_pass
      PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
      GOSU_VERSION: 1.14
      MYSQL_MAJOR: 8.0
      MYSQL_VERSION: 8.0.31-1.el8
      MYSQL_SHELL_VERSION: 8.0.31-1.el8
      MYSQL_ROOT_PASSWORD: allahuakbar
    ports:
      - "3306:3306"
    volumes:
      - dbdata:/var/lib/mysql
    networks:
      - jamb_byod_network
      - default

  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    container_name: jamb-phpmyadmin
    cpu_count: 25
    mem_limit: 120g
    links:
      - jamb-db
    environment:
      PMA_HOST: jamb-db
      PMA_PORT: 3306
#      PMA_ARBITRARY: 1
    restart: unless-stopped
    depends_on:
      - jamb-db
    ports:
      - 8001:80
    networks:
      - jamb_byod_network
      - default

  nginx:
    image: nginx:alpine
    container_name: jamb-byod-nginx
    restart: unless-stopped
    ports: [ '8015:80', '8016:443' ]
    cpu_count: 25
    mem_limit: 120g
    volumes:
      - ./:/var/www
      - ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf
      - ./docker/certificates/acd-certificate.crt:/cert/server.crt
      - ./docker/certificates/acd-certificate.key:/cert/server.key
    networks:
      default:
        aliases:
          - api.jambbyod.devl
      jamb_byod_network:
        aliases:
          - api.jambbyod.devl
    depends_on:
      - app

networks:
  default:
    driver: bridge
  jamb_byod_network:
    name: jamb_byod_network

volumes:
  dbdata:
