services:
  app:
    image: git.matthiasg.dev/ninluc/datbrowser:latest
    restart: unless-stopped
    ports:
      - 80:80
    volumes:
      - browserDownloads:/app/Browser/downloads
      - browserScreenshots:/app/Browser/screenshots
      - browserSource:/app/Browser/source
    depends_on:
      db:
        condition: service_healthy
      undetected-chromedriver:
        condition: service_healthy

  db:
    image: mysql:5.7
    restart: unless-stopped
    healthcheck:
      test: ["CMD", 'mysqladmin', 'ping', '-h', 'db', '-u', '${DB_USERNAME}', '-p${DB_PASSWORD}' ]
      interval: 2s
      timeout: 20s
      retries: 10
    environment:
      MYSQL_ROOT_PASSWORD: ${DB_PASSWORD}
      MYSQL_DATABASE: ${DB_DATABASE}
      MYSQL_USER: ${DB_USERNAME}
      MYSQL_PASSWORD: ${DB_PASSWORD}
    volumes:
      - dbdata:/var/lib/mysql

  undetected-chromedriver:
    image: git.matthiasg.dev/ninluc/selenium/standalone-uc:latest
    restart: unless-stopped
    volumes:
      - /tmp:/tmp
    shm_size: 2gb
    ports:
      - "4444:4444"
      - "7900:7900"

  watchtower:
    image: containrrr/watchtower
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock

volumes:
  dbdata:
  browserDownloads:
  browserScreenshots:
  browserSource:
