version: '3.0'
name: 'perpus-gky'

services:
  # Setup Application
  main:
    image: bitnami/laravel:10.3.3-debian-12-r27
    container_name: perpus_gky_app
    ports:
      - '3100:8000'
    # privileged: true
    hostname: perpus_gky_app
    environment:
      DB_HOST: perpus_gky_db
      DB_PORT: 3306
      DB_USERNAME: myuser
      DB_PASSWORD: userpassword
      DB_DATABASE: main_db
    volumes:
      - /host_mnt/d/Project/Josh/perpus-gky/app:/app
    networks:
      perpus_gky_network:
        ipv4_address: 192.168.10.2
    depends_on:
      - database

  # Setup Database
  database:
    image: mysql:8.3.0
    container_name: perpus_gky_db
    ports:
      - '3101:3306'
    hostname: perpus_gky_db
    environment:
      MYSQL_ROOT_PASSWORD: rootpassword
      MYSQL_USER: myuser
      MYSQL_PASSWORD: userpassword
      MYSQL_DATABASE: main_db
      MYSQL_CHARACTER_SET: utf8mb4
      MYSQL_COLLATION: utf8mb4_unicode_ci
    networks:
      perpus_gky_network:
        ipv4_address: 192.168.10.30
    volumes:
      - /host_mnt/d/Project/Josh/perpus-gky/database:/var/lib/mysql
      - /host_mnt/d/Project/Josh/perpus-gky/backup:/backup-data

# Setup network
networks:
  perpus_gky_network:
    driver: bridge
    ipam:
      config:
        - subnet: 192.168.10.0/27
