-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from avibn/dev
Version 2 improvements
- Loading branch information
Showing
17 changed files
with
622 additions
and
167 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,32 @@ | ||
# Use an official Python runtime as a parent image | ||
FROM python:3.11.9-bookworm | ||
|
||
# Install necessary packages | ||
RUN apt-get update && apt-get install -y --no-install-recommends curl ca-certificates | ||
|
||
# Add and run the UV installer script | ||
ADD https://astral.sh/uv/0.5.9/install.sh /uv-installer.sh | ||
RUN sh /uv-installer.sh && rm /uv-installer.sh | ||
|
||
# Set environment variables | ||
ENV PATH="/root/.local/bin/:$PATH" | ||
|
||
# Set working directory in the container to /app | ||
WORKDIR /app | ||
|
||
# Add current directory contents into the container at /app | ||
ADD . /app | ||
# Enable bytecode compilation | ||
ENV UV_COMPILE_BYTECODE=1 | ||
|
||
# Install the project's dependencies using the lockfile and settings | ||
RUN --mount=type=cache,target=/root/.cache/uv \ | ||
--mount=type=bind,source=uv.lock,target=uv.lock \ | ||
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \ | ||
uv sync --frozen --no-install-project --no-dev | ||
|
||
# Install packages from requirements.txt | ||
RUN pip install --no-cache-dir -r requirements.txt | ||
# Add the rest of the application code | ||
ADD . /app | ||
RUN --mount=type=cache,target=/root/.cache/uv \ | ||
uv sync --frozen --no-dev | ||
|
||
# Start the bot | ||
CMD ["python", "run.py"] | ||
CMD ["uv", "run", "python", "run.py"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,17 @@ | ||
[tool.black] | ||
line-length = 88 | ||
[project] | ||
name = "telegram-downloader" | ||
version = "0.1.0" | ||
description = "Telegram Bot to download video files sent to it" | ||
readme = "README.md" | ||
requires-python = ">=3.11" | ||
dependencies = [ | ||
"pydantic-settings>=2.7.0", | ||
"pydantic>=2.10.3", | ||
"python-dotenv>=1.0.1", | ||
"python-telegram-bot>=21.9", | ||
] | ||
|
||
[tool.uv] | ||
dev-dependencies = [ | ||
"ruff>=0.8.3", | ||
] |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,13 @@ | ||
from src.bot import main | ||
import logging | ||
|
||
# Enable logging | ||
logging.basicConfig( | ||
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", level=logging.INFO | ||
) | ||
logging.getLogger("httpx").setLevel(logging.WARNING) | ||
|
||
|
||
if __name__ == "__main__": | ||
from src.bot import main | ||
|
||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.