version: '3'

services:
  karideo_db_service:
    image: mysql:latest
    restart: always
    command: --default-authentication-plugin=mysql_native_password
    env_file:
      - ./config.env
    volumes:
      - /workspace/data/karideo/db:/var/lib/mysql
    mem_limit: 600m
    healthcheck:
      test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"]
      timeout: 20s
      retries: 10

  karauth_adminer_service:
    image: adminer:latest
    restart: always
    depends_on:
      - karideo_db_service
    ports:
      - 18079:8080
    links:
      - karideo_db_service:db
    mem_limit: 100m

  karideo_back_service:
    build: .
    restart: always
    image: gitea.atria-soft.org/kangaroo-and-rabbit/karideo:latest
    depends_on:
      - karideo_db_service
    ports:
      - 18080:18080
    env_file:
      - ./config.env
    links:
      - karideo_db_service:db
    volumes:
      - /workspace/data/karideo/media:/application/data
      - /workspace/data/karideo/tmp:/application/tmp
    # readonly error due to the temporary files, need test: System.setProperty("java.io.tmpdir", "/application/tmp"); maybe create some problem in the read/write access for the HDD drive...
    #read_only: true
    mem_limit: 1200m
    healthcheck:
      test: ["CMD", "wget" ,"http://localhost:18080/karideo/api/health_check", "-O", "/dev/null"]
      timeout: 20s
      retries: 3
