logging.basicConfig() ran after bridge_endpoints (via bridge_logging) had already attached a handler to the root logger at import time, making basicConfig() a no-op per Python's docs (it only configures the root logger when it has none yet). Every log.info/warning call after that point silently stopped reaching stdout/stderr - "docker logs" only ever showed whatever fired before this point. Moved basicConfig() to run before any extracted-module import, and added PYTHONUNBUFFERED=1 so output isn't buffered away under a non-TTY container stdout.
47 lines
1.6 KiB
Docker
47 lines
1.6 KiB
Docker
FROM python:3.11-slim-bookworm
|
||
|
||
WORKDIR /app
|
||
|
||
RUN apt-get update && apt-get install -y --no-install-recommends ffmpeg gcc python3-dev && rm -rf /var/lib/apt/lists/*
|
||
|
||
COPY requirements.txt .
|
||
RUN pip install --no-cache-dir -r requirements.txt && \
|
||
apt-get purge -y gcc python3-dev && apt-get autoremove -y && rm -rf /var/lib/apt/lists/*
|
||
|
||
COPY kobrax_moonraker_bridge.py .
|
||
COPY bridge_*.py .
|
||
COPY web/ ./web/
|
||
# Statische Daten (orca_filaments.json etc.) liegen in /app/static/, NICHT in
|
||
# /app/data/ — letzteres wird vom User als Volume gemountet (Runtime-State).
|
||
COPY data/ ./static/
|
||
COPY config_loader.py .
|
||
COPY env_loader.py .
|
||
COPY kobrax_client.py .
|
||
COPY orca_filaments.py .
|
||
COPY spoolman_client.py .
|
||
COPY kxgauge_client.py .
|
||
COPY gcode_store.py .
|
||
COPY gcode_meta.py .
|
||
COPY camera.py .
|
||
COPY credentials.py .
|
||
COPY VERSION .
|
||
COPY anycubic_slicer.crt .
|
||
COPY anycubic_slicer.key .
|
||
COPY config/config.ini.example /app/config/config.ini.example
|
||
|
||
# config/ ist ein Volume-Mountpoint – beim Start wird config.ini aus .env migriert
|
||
# falls noch keine config.ini vorhanden ist.
|
||
RUN mkdir -p /app/config && mkdir -p /app/data
|
||
|
||
# Daten-Verzeichnis fest auf /app/data (sonst würde der Binary-Default <exe-dir>/data greifen)
|
||
# und Container-Erkennung für den Bridge-Restart (Supervisor startet neu statt subprocess).
|
||
ENV KX_DATA_DIR=/app/data
|
||
ENV KX_IN_DOCKER=1
|
||
# Ohne das puffert Python stdout/stderr komplett wenn kein TTY angehängt ist -
|
||
# "docker logs" bleibt dann leer bis der Prozess beendet wird.
|
||
ENV PYTHONUNBUFFERED=1
|
||
|
||
EXPOSE 7125
|
||
|
||
ENTRYPOINT ["python", "kobrax_moonraker_bridge.py"]
|