-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
30 lines (22 loc) · 855 Bytes
/
Dockerfile
File metadata and controls
30 lines (22 loc) · 855 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
FROM python:3.12-slim
# System-Dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Dependencies zuerst (Layer-Caching)
COPY requirements.txt .
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
# Quellcode
COPY . .
# Persistente Verzeichnisse als Volume-Punkte
RUN mkdir -p data_store logs ai
# Nicht als root laufen
RUN useradd -m -u 1000 botuser && chown -R botuser:botuser /app
USER botuser
# Healthcheck — prüft ob bot.log in den letzten 70 Min geschrieben wurde (Bot-Zyklus = 1h)
HEALTHCHECK --interval=5m --timeout=10s --retries=3 \
CMD python -c "import os,time; f='logs/bot.log'; \
assert os.path.exists(f) and (time.time()-os.path.getmtime(f))<4200" || exit 1
CMD ["python", "bot.py"]