services:
  telegram-files:
    container_name: telegram-files
    image: ghcr.io/jarvis2f/telegram-files:latest
    restart: always
    # Uncomment the following lines to enable health check for the service.
    #    depends_on:
    #      telegram-files-postgres:
    #        condition: service_healthy
    #      telegram-files-mysql:
    #        condition: service_healthy
    healthcheck:
      test: [ "CMD", "curl", "-f", "http://127.0.0.1/api/health" ]
      interval: 10s
      retries: 3
      timeout: 10s
      start_period: 10s
    environment:
      # PUID and PGID are the user id and group id of the user who owns the files in the mounted volume.
      #PUID: 1000
      #PGID: 1000
      #NGINX_PORT: 80
      APP_ENV: "prod"
      APP_ROOT: "/app/data"
      TELEGRAM_API_ID: ${TELEGRAM_API_ID}
      TELEGRAM_API_HASH: ${TELEGRAM_API_HASH}
      # Uncomment the following lines to enable database connection, you can see .env.example for more details.
      #DB_TYPE: ${DB_TYPE}
      #DB_HOST: ${DB_HOST}
      #DB_PORT: ${DB_PORT}
      #DB_USER: ${DB_USER}
      #DB_PASSWORD: ${DB_PASSWORD}
      #DB_NAME: ${DB_NAME}
    ports:
      - "6543:80"
    volumes:
      - ./data:/app/data
      # - ./other-files-for-transfer:/app/other-files-for-transfer

# Uncomment the following lines to enable database services.
#  telegram-files-postgres:
#    container_name: telegram-files-postgres
#    image: postgres:15-alpine
#    restart: always
#    environment:
#      PGUSER: ${DB_USER:-postgres}
#      POSTGRES_PASSWORD: ${DB_PASSWORD:-postgres}
#      POSTGRES_DB: ${DB_NAME:-telegram-files}
#      PGDATA: /var/lib/postgresql/data/pgdata
#    volumes:
#      - ./data/db/data:/var/lib/postgresql/data
#    healthcheck:
#      test: [ 'CMD', 'pg_isready' ]
#      interval: 1s
#      timeout: 3s
#      retries: 30
#
#  telegram-files-mysql:
#    container_name: telegram-files-mysql
#    image: mysql:8
#    restart: always
#    environment:
#      MYSQL_ROOT_PASSWORD: ${DB_PASSWORD:-password}
#      MYSQL_DATABASE: ${DB_NAME:-telegram-files}
#      MYSQL_USER: ${DB_USER:-mysql}
#      MYSQL_PASSWORD: ${DB_PASSWORD:-password}
#    command:
#      --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
#    volumes:
#      - ./data/db/data:/var/lib/mysql
#    healthcheck:
#      test: [ "CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-p$MYSQL_ROOT_PASSWORD" ]
#      interval: 10s
#      timeout: 5s
#      retries: 5
#      start_period: 30s
