From a5df3133ac992132605f71029a96b326e27677e1 Mon Sep 17 00:00:00 2001 From: DIvan2000 Date: Thu, 14 Aug 2025 03:38:17 +0400 Subject: [PATCH] add Docker entrypoint for container initialization --- .dockerignore | 3 +-- .gitignore | 3 +-- Dockerfile | 2 ++ default_config.yaml | 16 ++++++++++++++++ entrypoint.sh | 7 +++++++ 5 files changed, 27 insertions(+), 4 deletions(-) create mode 100644 default_config.yaml create mode 100644 entrypoint.sh diff --git a/.dockerignore b/.dockerignore index f8f815d..82f0c3a 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,2 +1 @@ -/data/sync_token.txt -/data/.env +/data/ diff --git a/.gitignore b/.gitignore index d5ed784..82f0c3a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ -data/sync_token.txt -data/.env +/data/ diff --git a/Dockerfile b/Dockerfile index d980e8b..45f6cad 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,4 +4,6 @@ RUN apt-get update && apt-get install -y gcc libffi-dev build-essential && rm -r COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt COPY . . +RUN chmod +x /app/entrypoint.sh +ENTRYPOINT ["/app/entrypoint.sh"] CMD ["python", "main.py"] \ No newline at end of file diff --git a/default_config.yaml b/default_config.yaml new file mode 100644 index 0000000..ac4d425 --- /dev/null +++ b/default_config.yaml @@ -0,0 +1,16 @@ +homeserver_url: "https://example.org" +bot_user: "@MediaBot:example.org" +bot_password: "bot_password" +trusted_homeservers: + - "example.org" +command_prefix: "!media" + +download_audio: + services: + youtube: + tmp_dir: "/tmp" # Директория для временных файлов + timeout: 300 # Таймаут загрузки в секундах + proxy: none # Прокси для загрузки (например: "socks5://user:pass@host:port") + enabled: true + audio_quality: 192 # Качество аудио в kbps + max_duration: 1200 # Макс. длительность в секундах \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..7b82543 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,7 @@ +#!/bin/sh +# Копируем дефолтный config.yaml только если его нет +if [ ! -f /app/data/config.yaml ]; then + cp /app/default_config.yaml /app/data/config.yaml +fi + +exec "$@"