network-monitor/container/Dockerfile
neil 54a765510a Network monitor: hub, probes, Docker and native installers
Hub (FastAPI + no-build web UI):
- Network health: live probe/target matrix, status strips, incidents
- Probes: add (with install command), rename, remove, latency and throughput charts
- Clients merged from AdGuard, DHCP, query log and probe ARP tables; names,
  categories, suspicious flag, notes, per-client DNS requests
- Query log, domain detail (clients, related subdomains), blocked domains via
  the AdGuard Home /control API

Probe: tests peers (ping, HTTP, throughput), gateway, LAN and public DNS,
internet URLs and an optional VPS; buffers results while the hub is down.
Gateway and ARP from /proc/net on Linux, route/arp on macOS.

Install: install.sh (hub) and install-probe.sh (generated from it), each in
docker mode (compose; default on Linux hosts) or native mode (venv + systemd
or launchd; default on macOS and in LXC). Both modes deploy with an update
command that checks the new commit and rolls back on failure.

CLAUDE.md carries shared context for Claude Code sessions on each machine.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 18:10:29 -08:00

35 lines
1.3 KiB
Docker

# The image is the runtime only: Python, git and the scripts in this folder. The app's
# source is cloned into the /srv volume on first start and updated in place by `update`,
# so a rebuild is needed only when this folder or the Python version changes.
ARG PYTHON_VERSION=3.14
FROM python:${PYTHON_VERSION}-slim
RUN apt-get update \
&& apt-get install -y --no-install-recommends git openssh-client tini \
&& rm -rf /var/lib/apt/lists/*
ARG UID=1000
ARG GID=1000
RUN groupadd --gid "$GID" app \
&& useradd --uid "$UID" --gid app --create-home --shell /usr/sbin/nologin app \
&& mkdir -p /srv/src /srv/venv /srv/state /data \
&& chown -R app:app /srv /data \
&& git config --system --add safe.directory '*'
COPY container/lib.sh /usr/local/lib/app/lib.sh
COPY --chmod=755 container/entrypoint.sh /usr/local/bin/entrypoint
COPY --chmod=755 container/update.sh /usr/local/bin/update
ENV PATH=/srv/venv/bin:$PATH \
PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1 \
DATA_DIR=/data \
PORT=8000
USER app
WORKDIR /srv/src
EXPOSE 8000
HEALTHCHECK --interval=30s --timeout=5s --start-period=60s --retries=3 \
CMD python3 -c "import os, urllib.request; urllib.request.urlopen(f'http://127.0.0.1:{os.environ[\"PORT\"]}/healthz', timeout=3)"
ENTRYPOINT ["tini", "--", "entrypoint"]