diff --git a/.gitignore b/.gitignore index 496ee2c..fd799ac 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,4 @@ -.DS_Store \ No newline at end of file +.DS_Store + +# Download file is now generated at build time via Dockerfile +files/www/downloading diff --git a/Dockerfile b/Dockerfile index e4e3bbf..acab2d8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,6 +15,10 @@ ENV HTTP_PORT=3000 ENV HTTPS_PORT=3001 ENV SET_USER=101 +# Build arguments for generating download file at build time +ARG FILE_SIZE=31457280 +ARG FILE_NAME=downloading + COPY /files/OpenSpeedTest-Server.conf ${CONFIG} COPY /files/entrypoint.sh /entrypoint.sh COPY /files/renew.sh /renew.sh @@ -28,15 +32,23 @@ COPY /files/nginx.key /etc/ssl/ USER root VOLUME /var/log/letsencrypt + +# Generate random download file at build time (30MB by default) +# This reduces repository size and ensures unique test data per build +RUN apk add --no-cache --virtual .build-deps coreutils && \ + dd if=/dev/urandom of=/usr/share/nginx/html/$FILE_NAME bs=1 count=$FILE_SIZE && \ + apk del .build-deps && \ + rm -rf /var/cache/apk/* + RUN rm -rf /etc/nginx/conf.d/default.conf \ - && chown -R nginx /usr/share/nginx/html/ \ - && chmod 755 /usr/share/nginx/html/downloading \ - && chmod 755 /usr/share/nginx/html/upload \ - && chown nginx ${CONFIG} \ - && chmod 400 ${CONFIG} \ - && chown nginx /etc/nginx/nginx.conf \ - && chmod 400 /etc/nginx/nginx.conf \ - && chmod +x /entrypoint.sh \ + && chown -R nginx /usr/share/nginx/html/ \ + && chmod 755 /usr/share/nginx/html/$FILE_NAME \ + && chmod 755 /usr/share/nginx/html/upload \ + && chown nginx ${CONFIG} \ + && chmod 400 ${CONFIG} \ + && chown nginx /etc/nginx/nginx.conf \ + && chmod 400 /etc/nginx/nginx.conf \ + && chmod +x /entrypoint.sh \ && chmod +x /renew.sh @@ -56,7 +68,7 @@ RUN mkdir -p /var/log/letsencrypt && \ RUN mkdir -p /usr/share/nginx/html/.well-known/acme-challenge && \ chown -R nginx /usr/share/nginx/html/.well-known/acme-challenge && \ chmod 775 /usr/share/nginx/html/.well-known/acme-challenge - + RUN apk update && apk add ca-certificates && rm -rf /var/cache/apk/* RUN update-ca-certificates RUN apk add --no-cache certbot certbot-nginx diff --git a/files/www/downloading b/files/www/downloading deleted file mode 100644 index b78c32f..0000000 Binary files a/files/www/downloading and /dev/null differ