version: "3"
services:
  app:
    container_name: python-app
    # command: python -m uvicorn app.main:app --host 0.0.0.0 --port 80
    build:
      context: .
      dockerfile: Dockerfile
    volumes:
      - ./app:/python
      - ./unizeug:/unizeug:source
    ports:
      - 80:80
    restart: unless-stopped
    environment:
      ENTRY_COMMAND: python -m uvicorn main:app --host 0.0.0.0 --port 80
      APP_LOG_PATH: /python/app.log
      APP_ROOT_PATH: /python
      UNIZEUG_PATH: /unizeug
      DB_HOST: db
      DB_USER: app
      DB_PASSWORD: DBPassword
      DB_DATABASE: Unizeug
      TZ: "Europe/Vienna"

    depends_on:
      - db
      - scaner
  db:
    container_name: db
    image: mariadb
    restart: unless-stopped
    environment:
      MARIADB_ROOT_PASSWORD: DBPassword
      MARIADB_USER: app
      UNIZEUG_PATH: /unizeug
      MARIADB_PASSWORD: DBPassword
      MARIADB_DATABASE: Unizeug
      TZ: "Europe/Vienna"
    healthcheck:
      test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
      start_period: 10s
      interval: 10s
      timeout: 5s
      retries: 3
    volumes:
      - ./mariadb:/var/lib/mysql
  scaner:
    container_name: python-scaner
    # command: python /python/init.py
    build:
      context: .
      dockerfile: Dockerfile
    volumes:
      - ./app:/python
      - ./unizeug:/unizeug:source
    restart: unless-stopped
    environment:
      ENTRY_COMMAND: python /python/init.py
      UNIZEUG_PATH: /unizeug
      DB_HOST: db
      DB_USER: app
      DB_PASSWORD: DBPassword
      DB_DATABASE: Unizeug
      TZ: "Europe/Vienna"
    depends_on:
      - db
