docker update

This commit is contained in:
Franz Rolfsvaag 2025-08-09 14:36:57 +02:00
parent 7a0c4645d7
commit acecd446b8
3 changed files with 46 additions and 1 deletions

1
.gitignore vendored
View File

@ -9,3 +9,4 @@ venv/
data/
data.json
settings.conf
settings local.conf

21
docker-compose.yml Normal file
View File

@ -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 (dont 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:

23
dockerfile Normal file
View File

@ -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"]