21 lines
607 B
Docker
21 lines
607 B
Docker
FROM python:3.12-slim
|
|
WORKDIR /app
|
|
|
|
# Install cron, curl, and the official Ookla Speedtest repository
|
|
RUN apt-get update && apt-get install -y cron curl \
|
|
&& curl -s https://packagecloud.io/install/repositories/ookla/speedtest-cli/script.deb.sh | bash \
|
|
&& apt-get install -y speedtest \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
COPY . .
|
|
|
|
# Set up the cron job
|
|
COPY crontab /etc/cron.d/speedtest-cron
|
|
RUN chmod 0644 /etc/cron.d/speedtest-cron
|
|
RUN crontab /etc/cron.d/speedtest-cron
|
|
|
|
ENV DB_PATH=/app/speedtests.db
|
|
|
|
# Dump env vars for cron and start the daemon
|
|
CMD printenv > /etc/environment && cron -f
|