From b717c032aa921ec6eb66ac2b2500b87515cf416f Mon Sep 17 00:00:00 2001 From: tema Date: Wed, 12 Oct 2022 22:54:44 +0300 Subject: [PATCH 1/2] Added patch to fix loop in aiogram --- dockerfile | 1 + utils/patch/aiogram-loop.patch | 20 ++++++++++++++++++++ utils/patch/aiogram-patch-loop.sh | 6 ++++++ 3 files changed, 27 insertions(+) create mode 100644 utils/patch/aiogram-loop.patch create mode 100644 utils/patch/aiogram-patch-loop.sh diff --git a/dockerfile b/dockerfile index 2dda1af..39011f2 100644 --- a/dockerfile +++ b/dockerfile @@ -13,4 +13,5 @@ RUN apk update \ postgresql-dev RUN pip install --no-cache-dir -r requirements.txt +RUN sh ./utils/patch/aiogram-patch-loop.sh CMD ["python3", "bot.py"] diff --git a/utils/patch/aiogram-loop.patch b/utils/patch/aiogram-loop.patch new file mode 100644 index 0000000..0155d7a --- /dev/null +++ b/utils/patch/aiogram-loop.patch @@ -0,0 +1,20 @@ +--- executor.py 2022-10-12 22:22:11.820907568 +0300 ++++ executor.py.1 2022-10-12 22:23:26.660883642 +0300 +@@ -105,7 +105,7 @@ + check_ip=check_ip, + retry_after=retry_after, + route_name=route_name) +- executor.run_app(**kwargs) ++ executor.run_app(loop=loop, **kwargs) + + + def start(dispatcher, future, *, loop=None, skip_updates=None, +@@ -303,6 +303,8 @@ + :return: + """ + self.set_webhook(webhook_path=webhook_path, request_handler=request_handler, route_name=route_name) ++ if "loop" not in kwargs: ++ kwargs["loop"] = self.loop + self.run_app(**kwargs) + + def start_polling(self, reset_webhook=None, timeout=20, relax=0.1, fast=True, diff --git a/utils/patch/aiogram-patch-loop.sh b/utils/patch/aiogram-patch-loop.sh new file mode 100644 index 0000000..bdb0ba8 --- /dev/null +++ b/utils/patch/aiogram-patch-loop.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +#https://github.com/aiogram/aiogram/pull/795 + +PYTHON_LIB_PATH=$(python3 -c 'import sys; print(sys.path[4])') +patch --directory=$PYTHON_LIB_PATH/aiogram/utils/ -i $(pwd)/utils/patch/aiogram-loop.patch \ No newline at end of file -- 2.45.2 From a5b26beba0a8c07ca326be335aad5112476215ca Mon Sep 17 00:00:00 2001 From: tema Date: Wed, 12 Oct 2022 23:45:58 +0300 Subject: [PATCH 2/2] requirements fix --- .dockerignore | 1 + dockerfile | 2 +- requirements.txt | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..0fe5998 --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +./venv/ diff --git a/dockerfile b/dockerfile index 39011f2..41410ab 100644 --- a/dockerfile +++ b/dockerfile @@ -6,7 +6,7 @@ WORKDIR /usr/src/bot RUN apk update \ && apk add \ build-base \ - gcc \ + gcc git openssh \ musl-dev \ python3-dev \ py3-pip \ diff --git a/requirements.txt b/requirements.txt index 14a7e09..395417e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,6 +2,8 @@ #google-auth-httplib2 #google-auth-oauthlib bs4 +requests +GitPython lxml peewee aiogram -- 2.45.2