kopia lustrzana https://github.com/mkdryden/telegram-stats-bot
Added Dockerfile and docker-compose config
rodzic
efd9d67a67
commit
e199158632
|
@ -0,0 +1,17 @@
|
||||||
|
FROM python:3.9
|
||||||
|
|
||||||
|
WORKDIR /usr/src/app
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
RUN pip install --no-cache-dir poetry
|
||||||
|
RUN poetry install
|
||||||
|
|
||||||
|
ENV TZ="America/Toronto" \
|
||||||
|
BOT_TOKEN=-1 \
|
||||||
|
CHAT_ID=0 \
|
||||||
|
POSTGRES_USER=postgres \
|
||||||
|
POSTGRES_PASSWORD=password \
|
||||||
|
POSTGRES_HOST=db \
|
||||||
|
POSTGRES_DB=telegram_bot
|
||||||
|
|
||||||
|
CMD [ "sh", "-c", "poetry run python -m telegram_stats_bot.main --tz=$TZ $BOT_TOKEN $CHAT_ID postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST/$POSTGRES_DB" ]
|
|
@ -35,6 +35,8 @@ Table of contents
|
||||||
|
|
||||||
- `Installation`_
|
- `Installation`_
|
||||||
|
|
||||||
|
- `Docker`_
|
||||||
|
|
||||||
- `Setup`_
|
- `Setup`_
|
||||||
|
|
||||||
- `Fetching Stats`_
|
- `Fetching Stats`_
|
||||||
|
@ -133,6 +135,13 @@ Or you can install the latest git version using `poetry <https://python-poetry.o
|
||||||
|
|
||||||
Installing directly with ``setup.py`` should also work from the Pypi sdist (but why?).
|
Installing directly with ``setup.py`` should also work from the Pypi sdist (but why?).
|
||||||
|
|
||||||
|
------
|
||||||
|
Docker
|
||||||
|
------
|
||||||
|
|
||||||
|
A Docker image is available under ``mkdryden/telegram-stats-bot`` and a sample ``docker-compose.yml`` is in the root of the repository including database setup.
|
||||||
|
Be sure to set the ``TZ``, ``BOT_TOKEN``, and ``CHAT_ID`` environment variable appropriately in your ``docker-run`` command or the ``docker-compose.yml`` file.
|
||||||
|
|
||||||
-----
|
-----
|
||||||
Setup
|
Setup
|
||||||
-----
|
-----
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
version: "3.8"
|
||||||
|
|
||||||
|
services:
|
||||||
|
telegram-stats-bot:
|
||||||
|
# Uncomment to use local version
|
||||||
|
# build:
|
||||||
|
# context: .
|
||||||
|
image: mkdryden/telegram-stats-bot:latest
|
||||||
|
depends_on:
|
||||||
|
- db
|
||||||
|
environment:
|
||||||
|
TZ: "America/Toronto"
|
||||||
|
BOT_TOKEN: 111111111:AAA-MpBVQ7i2cIRfwedfsfesdg6webc0r-Y
|
||||||
|
CHAT_ID: 0
|
||||||
|
POSTGRES_USER: postgres
|
||||||
|
POSTGRES_PASSWORD: password
|
||||||
|
POSTGRES_HOST: db
|
||||||
|
POSTGRES_DB: telegram_bot
|
||||||
|
db:
|
||||||
|
image: postgres:12
|
||||||
|
restart: always
|
||||||
|
volumes:
|
||||||
|
- db-data:/var/lib/postgresql/data
|
||||||
|
environment:
|
||||||
|
POSTGRES_PASSWORD: password
|
||||||
|
POSTGRES_DB: telegram_bot
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
db-data:
|
Ładowanie…
Reference in New Issue