version: "3"
services:
  killbill:
    build: .
    container_name: killbill
    depends_on:
      - "db"
    links:
      - db
    command: bash -c 'while !</dev/tcp/db/3306; do sleep 5; done; bash run.sh'
    ports:
      - "8080:8080"
      - "8000:8000"
      - "12345:12345"
    environment:
      - KILLBILL_DAO_URL=jdbc:mysql://db:3306/killbill
      - KILLBILL_DAO_USER=root
      - KILLBILL_DAO_PASSWORD=killbill
      - JAVA_OPTS=${JAVA_OPTS:-"-Xms4096m -Xmx6124m"}
      - CACHE_EVENTS=${CACHE_EVENTS:-/caching-approaches-comparison/applications/output/killbill-developers-cache}
      - CACHE_REGISTER_SIZE=false
    volumes:
      - application:/application
      - /root/.m2:/root/.m2
      - ../../../:/caching-approaches-comparison
    restart: unless-stopped
    logging:
      options:
        max-size: "10m"
        max-file: "10"

  db:
    image: mariadb:10.4
    expose:
      - 3306
    volumes:
      - ../../dumps/killbill.sql:/docker-entrypoint-initdb.d/init.sql
      - database:/var/lib/mysql
    environment:
      MYSQL_USER: root
      MYSQL_ROOT_PASSWORD: killbill
      MYSQL_DATABASE: killbill
    restart: unless-stopped
    logging:
      options:
        max-size: "10m"
        max-file: "10"

volumes:
  application:
  database:
