version: '3.8'

services:
  # PHP
  webserver:
    restart: always
    container_name: PHP-webserver-powergassystem
    build: .
    ports:
      - 8184:80
    depends_on:
      - db
    networks:
      - php-mysql-network
  
  #API
  api:
    restart: always
    container_name: PHP-api-api_powergas
    build: ./api_powergas
    ports:
      - 8083:80
    depends_on:
      - db
    networks:
      - php-mysql-network
  # MySQL
  db:
    restart: always
    container_name: mariadb
    image: mariadb:11.2
    environment:
      MARIADB_ROOT_PASSWORD: web_101
      MARIADB_DATABASE: powergas_system
      MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
    ports:
      - '3308:3306'
    volumes:
      - './docker/db/data:/var/lib/mysql'
      - './docker/db/my.cnf:/etc/mysql/conf.d/my.cnf'
      - './docker/db/sql:/docker-entrypoint-initdb.d'
    networks:
      - php-mysql-network
  #SSL_CERTIFICATE
  https-portal:
    image: steveltn/https-portal:1
    ports:
      - 8084:80
      - 8085:443
    environment:
      DOMAINS: 'powergas.techsavanna.co.ke -> http://webserver:80, www.powergas.techsavanna.co.ke -> http://webserver:80'
      STAGE: 'production'
    volumes:
      - https-portal-data:/var/lib/https-portal
    networks:
      - php-mysql-network

volumes:
  https-portal-data:

networks:
  php-mysql-network:
    name: php-mysql-network
