From acecd446b83fcfef46df3658333fac74d96fb747 Mon Sep 17 00:00:00 2001 From: Franz Rolfsvaag Date: Sat, 9 Aug 2025 14:36:57 +0200 Subject: [PATCH] docker update --- .gitignore | 3 ++- docker-compose.yml | 21 +++++++++++++++++++++ dockerfile | 23 +++++++++++++++++++++++ 3 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 docker-compose.yml create mode 100644 dockerfile diff --git a/.gitignore b/.gitignore index 76da19c..6d7a9fa 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,5 @@ venv/ # Local data & secrets (we’ll mount these in Docker) data/ data.json -settings.conf \ No newline at end of file +settings.conf +settings local.conf \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..95239e2 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,21 @@ +version: "3.8" + +services: + shaiwatcher: + build: . + image: shaiwatcher:latest # local image name (Portainer builds it) + container_name: shaiwatcher + restart: unless-stopped + environment: + # set this in Portainer (don’t commit your token!) + - DISCORD_TOKEN=${DISCORD_TOKEN} + # optional: set timezone + - TZ=UTC + volumes: + # Persist your JSON data here + - shaiwatcher-data:/app/data + # Bind your server-side settings.conf into the container + - /opt/shaiwatcher/settings.conf:/app/settings.conf:ro + +volumes: + shaiwatcher-data: diff --git a/dockerfile b/dockerfile new file mode 100644 index 0000000..3c097a8 --- /dev/null +++ b/dockerfile @@ -0,0 +1,23 @@ +# Simple, small image +FROM python:3.11-slim + +ENV PYTHONUNBUFFERED=1 \ + PIP_NO_CACHE_DIR=1 + +# System deps (add git if you need it) +RUN apt-get update && apt-get install -y --no-install-recommends \ + ca-certificates tzdata && \ + rm -rf /var/lib/apt/lists/* + +WORKDIR /app + +# Install deps first (better cache) +COPY requirements.txt . +RUN pip install -r requirements.txt + +# Copy the app +COPY . . + +# The bot reads settings.conf from /app/settings.conf +# The data file should live in /app/data (mounted as a volume) +CMD ["python", "-u", "bot.py"]