FROM python:3.13-slim ENV PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1 DB_PATH=/data/bot.db WORKDIR /srv COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt COPY app ./app # Run as a non-root user; the SQLite database lives in the /data volume. RUN useradd --uid 10001 --create-home bot && mkdir -p /data && chown bot:bot /data USER bot VOLUME ["/data"] EXPOSE 8000 HEALTHCHECK --interval=30s --timeout=5s --retries=3 \ CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/health', timeout=4)" # --proxy-headers so the app sees the real client address behind Traefik. CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000", \ "--proxy-headers", "--forwarded-allow-ips", "*"]