Initial commit
This commit is contained in:
39
Dockerfile
Normal file
39
Dockerfile
Normal file
@@ -0,0 +1,39 @@
|
||||
FROM debian:stable-slim
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
# 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 \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install Ookla Speedtest CLI via packagecloud repository
|
||||
RUN curl -s https://packagecloud.io/install/repositories/ookla/speedtest-cli/script.deb.sh | bash \
|
||||
&& apt-get update \
|
||||
&& apt-get install -y --no-install-recommends speedtest \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Create web root and data directories
|
||||
RUN mkdir -p /var/www && mkdir -p /var/www/data/speed
|
||||
WORKDIR /var/www
|
||||
|
||||
# Copy web assets and scripts
|
||||
COPY index.html /var/www/index.html
|
||||
COPY run_speed_test.sh /usr/local/bin/run_speed_test.sh
|
||||
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
|
||||
CMD ["/usr/local/bin/start.sh"]
|
||||
Reference in New Issue
Block a user