diff options
author | clarkzjw <[email protected]> | 2022-11-24 22:11:03 -0800 |
---|---|---|
committer | clarkzjw <[email protected]> | 2022-11-24 22:11:03 -0800 |
commit | d19a3e6bdd8ad77cf0d90cc882880d9f3e1433b4 (patch) | |
tree | 5c41c76ea256efa84db48afcdb55ea6d3c4f3931 | |
parent | 7451d6229a8fcb0442adaa9be2af26173b9c363b (diff) | |
download | Square-d19a3e6bdd8ad77cf0d90cc882880d9f3e1433b4.tar.gz |
docker: add Dockerfile
-rw-r--r-- | .dockerignore | 5 | ||||
-rw-r--r-- | Dockerfile | 11 | ||||
-rw-r--r-- | bot.py | 22 |
3 files changed, 20 insertions, 18 deletions
diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..a0c4f0f --- /dev/null +++ b/.dockerignore | |||
@@ -0,0 +1,5 @@ | |||
1 | .venv/ | ||
2 | venv/ | ||
3 | .git/ | ||
4 | __pycache__/ | ||
5 | .idea/ | ||
diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..202b577 --- /dev/null +++ b/Dockerfile | |||
@@ -0,0 +1,11 @@ | |||
1 | FROM python:3 | ||
2 | |||
3 | WORKDIR /app | ||
4 | |||
5 | COPY requirements.txt ./ | ||
6 | |||
7 | RUN pip install --no-cache-dir -r requirements.txt | ||
8 | |||
9 | ADD *.py ./ | ||
10 | |||
11 | CMD ["python", "./bot.py"] | ||
@@ -3,25 +3,11 @@ import logging | |||
3 | import os | 3 | import os |
4 | import traceback | 4 | import traceback |
5 | 5 | ||
6 | from telegram import __version__ as TG_VER | ||
7 | |||
8 | try: | ||
9 | from telegram import __version_info__ | ||
10 | except ImportError: | ||
11 | __version_info__ = (0, 0, 0, 0, 0) # type: ignore[assignment] | ||
12 | |||
13 | if __version_info__ < (20, 0, 0, "alpha", 1): | ||
14 | raise RuntimeError( | ||
15 | f"This example is not compatible with your current PTB version {TG_VER}. To view the " | ||
16 | f"{TG_VER} version of this example, " | ||
17 | f"visit https://docs.python-telegram-bot.org/en/v{TG_VER}/examples.html" | ||
18 | |||
19 | ) | ||
20 | |||
21 | from telegram import ForceReply, Update, File | ||
22 | from telegram.ext import Application, CommandHandler, ContextTypes, MessageHandler, filters | ||
23 | from telegram.constants import ParseMode | ||
24 | from PIL import Image | 6 | from PIL import Image |
7 | from telegram import Update | ||
8 | from telegram.constants import ParseMode | ||
9 | from telegram.ext import Application, CommandHandler, ContextTypes, MessageHandler, filters | ||
10 | |||
25 | from square import square_size_padding | 11 | from square import square_size_padding |
26 | 12 | ||
27 | # Enable logging | 13 | # Enable logging |