Added new parameter CRON_MINUTE to docker image

This can be used to start the cron on a specific minute within
the hour. By default, the cron will run in the 10th minute
This commit is contained in:
2025-12-06 14:59:43 -08:00
parent 8d4d317330
commit 10be012150
2 changed files with 15 additions and 14 deletions

View File

@@ -2,6 +2,13 @@ FROM debian:stable-slim
ENV DEBIAN_FRONTEND=noninteractive
# Default is to run cron job in the 10th minute of each hour
# You can override at runtime with -e CRON_MINUTE=xx
ENV CRON_MINUTE=10
# Default port for http server inside container.
# You can override at runtime with -e PORT=xxxx
ENV PORT=8080
# Install required packages: curl, cron, busybox (httpd), ca-certificates
RUN apt-get update \
&& apt-get install -y --no-install-recommends curl cron busybox ca-certificates gnupg dirmngr \
@@ -25,14 +32,8 @@ COPY start.sh /usr/local/bin/start.sh
# Ensure scripts are executable
RUN chmod +x /usr/local/bin/run_speed_test.sh /usr/local/bin/start.sh
# Add cron job to run every hour at minute 0
RUN printf "0 * * * * root /usr/local/bin/run_speed_test.sh >> /var/log/cron.log 2>&1\n" > /etc/cron.d/speedtest-cron \
&& chmod 0644 /etc/cron.d/speedtest-cron
# Expose default HTTP port and declare data volume
VOLUME ["/var/www/data/speed"]
# Default port for http server inside container. You can override at runtime with -e PORT=xxxx
ENV PORT=8080
EXPOSE 8080
# Start script will launch cron and the HTTP server