From cadbe9b8e68d605a4905b5f604cbce7219872256 Mon Sep 17 00:00:00 2001 From: Zachary Fouts Date: Mon, 11 Jan 2021 08:34:24 -0600 Subject: [PATCH] Support using docker for your bot --- Dockerfile | 7 +++++++ README.md | 6 +++++- .../.ssdb_config.ini.template | 0 docker-compose.yml | 8 ++++++++ ssdb.py | 2 +- 5 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 Dockerfile rename .ssdb_config.ini.template => config/.ssdb_config.ini.template (100%) create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..35c3b05 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.7-buster + +COPY . /app +WORKDIR /app + +RUN pip3 install -r requirements.txt +CMD python3 ./ssdb.py diff --git a/README.md b/README.md index 28fc63b..4bbd166 100644 --- a/README.md +++ b/README.md @@ -4,5 +4,9 @@ Creates a list of Source engine game servers and updates it regularly. Useful fo ## Instructions - Make sure you have Python 3 installed and in your PATH. - Run `pip install -r requirements.txt` -- Configure `.ssdb_config.ini` (remove .template from name) with at least the bot token, channel id and the list method +- Configure `config/.ssdb_config.ini` (remove .template from name) with at least the bot token, channel id and the list method - Run `run.bat` or `run.sh` + +**Docker Instructions (Optional)**: +- Make sure you have Docker and `docker-compose` in your PATH +- Run (docker) `docker-compose up --build` or `docker-compose up -d` diff --git a/.ssdb_config.ini.template b/config/.ssdb_config.ini.template similarity index 100% rename from .ssdb_config.ini.template rename to config/.ssdb_config.ini.template diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..dbe20f4 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,8 @@ +version: '3' + +services: + ssdb: + restart: always + build: ./ + volumes: + - ./config:/app/config diff --git a/ssdb.py b/ssdb.py index 2559396..ce35af2 100644 --- a/ssdb.py +++ b/ssdb.py @@ -681,7 +681,7 @@ def check_update_loop(self): # Read our config config = configparser.ConfigParser() config_name = path.join( - path.dirname(__file__), ".ssdb_config.ini") + path.dirname(__file__), "config/.ssdb_config.ini") with open(config_name, 'r') as fp: config.read_file(fp)