Compare commits
No commits in common. "a8f39d46309304c37a1a42d7dd7c5873ddc1e36f" and "4ac6be06cfe7b2b3bd531a9297cb72429776f82d" have entirely different histories.
a8f39d4630
...
4ac6be06cf
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,6 +3,5 @@ __pycache__/
|
|||||||
venv/
|
venv/
|
||||||
.venv/
|
.venv/
|
||||||
logs/
|
logs/
|
||||||
data/
|
|
||||||
*.env
|
*.env
|
||||||
*.db
|
*.db
|
||||||
|
|||||||
29
Dockerfile
29
Dockerfile
@ -19,21 +19,20 @@ RUN --mount=type=cache,target=/root/.cache/pip \
|
|||||||
--mount=type=bind,source=requirements.txt,target=requirements.txt \
|
--mount=type=bind,source=requirements.txt,target=requirements.txt \
|
||||||
pip install -r requirements.txt
|
pip install -r requirements.txt
|
||||||
|
|
||||||
# copy sources
|
# copy i18n files
|
||||||
COPY --chown=bot --chmod=774 docker-entrypoint.sh /app/
|
COPY --chown=bot i18n.yaml /i18n/i18n.yaml
|
||||||
COPY --chown=bot migrations /app/migrations
|
|
||||||
COPY --chown=bot mybot /app/mybot
|
|
||||||
COPY --chown=bot i18n.yaml /app/
|
|
||||||
|
|
||||||
# prepare environment
|
# copy default configs
|
||||||
ENV I18N_PATH=/data/i18n.yaml
|
|
||||||
ENV DB_URL=sqlite:////data/bot.db
|
|
||||||
|
|
||||||
RUN mkdir -p /data
|
|
||||||
RUN chown bot:bot /data
|
|
||||||
VOLUME /data
|
|
||||||
|
|
||||||
USER bot
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
COPY --chown=bot mybot mybot
|
||||||
|
|
||||||
ENTRYPOINT ["./docker-entrypoint.sh"]
|
# preapre environment
|
||||||
|
ENV SS_TYPE=memory
|
||||||
|
ENV I18N_PATH=/i18n/i18n.yaml
|
||||||
|
|
||||||
|
# set user
|
||||||
|
USER bot
|
||||||
|
|
||||||
|
CMD ["python3", "-m", "mybot"]
|
||||||
|
|
||||||
|
VOLUME i18n/
|
||||||
|
|||||||
@ -1,17 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
if [ ! -f ${I18N_PATH} ]; then
|
|
||||||
cp i18n.yaml ${I18N_PATH}
|
|
||||||
fi
|
|
||||||
|
|
||||||
alembic -c migrations/alembic.ini upgrade head
|
|
||||||
|
|
||||||
if [ $# -eq 0 ]; then
|
|
||||||
if [ -z "${USE_WEBHOOK}" ]; then
|
|
||||||
exec python3 -m mybot
|
|
||||||
else
|
|
||||||
exec gunicorn -b 0.0.0.0:8080 "mybot:main()"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
exec $1
|
|
||||||
fi
|
|
||||||
@ -23,8 +23,8 @@ def create_bot(config: Config, i18n: I18N, engine):
|
|||||||
register_handlers(bot)
|
register_handlers(bot)
|
||||||
setup_middlewares(bot, i18n, engine)
|
setup_middlewares(bot, i18n, engine)
|
||||||
add_custom_filters(bot, config)
|
add_custom_filters(bot, config)
|
||||||
bot.delete_webhook()
|
|
||||||
if config.use_webhook:
|
if config.use_webhook:
|
||||||
|
bot.delete_webhook()
|
||||||
bot.set_webhook(config.webhook.url,
|
bot.set_webhook(config.webhook.url,
|
||||||
drop_pending_updates=config.webhook.drop_pending_updates,
|
drop_pending_updates=config.webhook.drop_pending_updates,
|
||||||
max_connections=config.webhook.max_connections)
|
max_connections=config.webhook.max_connections)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user