FROM python:3.15-slim@sha256:65a65fc7b30b06cb6df4930fd4650697cb23f4c2698ab81fc87e4b031bc36928 # Re-runs the security-update layer once a day despite the layer cache (CI # passes the date). ARG OS_UPDATES=none RUN apt-get update && apt-get -y upgrade && rm -rf /var/lib/apt/lists/* WORKDIR /app COPY requirements.txt . # pip is not needed at runtime and vendors its own urllib3, msgpack and # pkg_resources, which the Trivy gate flags whenever they lag behind: install, # then remove pip and the ensurepip wheel. RUN pip install --no-cache-dir -r requirements.txt \ && pip uninstall -y pip \ && rm -rf /usr/local/lib/python3*/ensurepip COPY meshcore_exporter.py . # The serial port belongs to group dialout (20) on most hosts; compose adds # the group with `group_add` when it differs. RUN useradd --system --uid 10001 --gid 20 --no-create-home exporter USER exporter EXPOSE 9200 HEALTHCHECK --interval=60s --timeout=5s --start-period=30s \ CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:9200/metrics', timeout=4)" ENTRYPOINT ["python", "/app/meshcore_exporter.py"]