From d19a3e6bdd8ad77cf0d90cc882880d9f3e1433b4 Mon Sep 17 00:00:00 2001 From: clarkzjw Date: Thu, 24 Nov 2022 22:11:03 -0800 Subject: docker: add Dockerfile --- .dockerignore | 5 +++++ Dockerfile | 11 +++++++++++ bot.py | 22 ++++------------------ 3 files changed, 20 insertions(+), 18 deletions(-) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..a0c4f0f --- /dev/null +++ b/.dockerignore @@ -0,0 +1,5 @@ +.venv/ +venv/ +.git/ +__pycache__/ +.idea/ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..202b577 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM python:3 + +WORKDIR /app + +COPY requirements.txt ./ + +RUN pip install --no-cache-dir -r requirements.txt + +ADD *.py ./ + +CMD ["python", "./bot.py"] diff --git a/bot.py b/bot.py index bf19588..979b025 100644 --- a/bot.py +++ b/bot.py @@ -3,25 +3,11 @@ import logging import os import traceback -from telegram import __version__ as TG_VER - -try: - from telegram import __version_info__ -except ImportError: - __version_info__ = (0, 0, 0, 0, 0) # type: ignore[assignment] - -if __version_info__ < (20, 0, 0, "alpha", 1): - raise RuntimeError( - f"This example is not compatible with your current PTB version {TG_VER}. To view the " - f"{TG_VER} version of this example, " - f"visit https://docs.python-telegram-bot.org/en/v{TG_VER}/examples.html" - - ) - -from telegram import ForceReply, Update, File -from telegram.ext import Application, CommandHandler, ContextTypes, MessageHandler, filters -from telegram.constants import ParseMode from PIL import Image +from telegram import Update +from telegram.constants import ParseMode +from telegram.ext import Application, CommandHandler, ContextTypes, MessageHandler, filters + from square import square_size_padding # Enable logging -- cgit v1.2.3