version: '3.9'

services:
  app:
    build:
      context: .
    user: "0:0"
    depends_on:
      db:
        condition: service_healthy
    volumes:
      - backend_storage:/app/storage
    ports:
      - "8090:8090"
      - "8080:8080"
    labels:
      traefik.enable: true
    networks:
      - default

  db:
    image: percona:8.0
    environment:
      - MYSQL_DATABASE=cattr
      - MYSQL_ROOT_PASSWORD=password
      - MYSQL_INITDB_SKIP_TZINFO=1
    cap_add:
      - SYS_NICE
    volumes:
      - database:/var/lib/mysql
    healthcheck:
      test: ['CMD', 'mysqladmin', 'ping', '-h', 'localhost', '--password=password', '-u', 'root']
      timeout: 20s
      retries: 10

volumes:
  backend_storage: {}
  database: {}

networks:
  default: {}
