version: "3"

services:
  slims:
    container_name: slims
    build:
      context: .
      dockerfile: Dockerfile
    environment:
      - ENV=production
      - DB_HOST=db
      - DB_PORT=3306
      - DB_USER=root
      - DB_PASS=Pass123
      - DB_NAME=senayan
    volumes:
      - appfiles:/var/www/html/files
      - appimages:/var/www/html/images
      - apprepo:/var/www/html/repository
    ports:
      - "${HTTP_PORT}:80"
    networks:
      - proxy
    depends_on:
      - db

  db:
    image: mariadb:lts
    container_name: db
    ports:
      - "${DB_PORT}:3306"
    volumes:
      - ./install/senayan_ddl.sql:/docker-entrypoint-initdb.d/init.sql
      - dbdata:/var/lib/mysql
    environment:
      - MARIADB_ROOT_PASSWORD=Pass123
      - MARIADB_DATABASE=senayan
    networks:
      - proxy

networks:
  proxy:
    driver: bridge

volumes:
  dbdata:
  appfiles:
  appimages:
  apprepo:
