FROM python:3.13-slim
ARG OOKLA=https://install.speedtest.net/app/cli/ookla-speedtest-1.2.0-linux-x86_64.tgz
RUN pip install --no-cache-dir prometheus_client \
 && python -c "import urllib.request,tarfile,io; tarfile.open(fileobj=io.BytesIO(urllib.request.urlopen('$OOKLA').read())).extract('speedtest','/usr/local/bin')" \
 && chmod 755 /usr/local/bin/speedtest && speedtest --version | head -1
COPY speedtest_exporter.py /app/speedtest_exporter.py
USER nobody
ENV HOME=/tmp
CMD ["python", "-u", "/app/speedtest_exporter.py"]
