1
0

Dockerfile.alpine 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. FROM alpine:3.24
  2. RUN apk add --quiet --no-cache \
  3. bash \
  4. apache2 \
  5. ca-certificates \
  6. php \
  7. php-apache2 \
  8. php-ctype \
  9. php-phar \
  10. php-gd \
  11. php-openssl \
  12. php-pdo \
  13. php-pdo_mysql \
  14. php-pdo_pgsql \
  15. php-pdo_sqlite \
  16. php-pgsql \
  17. php-session \
  18. php-sqlite3
  19. RUN ln -sf /dev/stdout /var/log/apache2/access.log && \
  20. ln -sf /dev/stderr /var/log/apache2/error.log
  21. # Install the ini into the scan dir PHP itself reports.
  22. COPY docker/librespeed-php.ini /tmp/librespeed-php.ini
  23. RUN set -eu; \
  24. scan_dir="$(php -r 'echo rtrim(PHP_CONFIG_FILE_SCAN_DIR);')"; \
  25. if [ -z "$scan_dir" ]; then \
  26. echo "ERROR: PHP_CONFIG_FILE_SCAN_DIR is empty" >&2; \
  27. exit 1; \
  28. fi; \
  29. install -m 0644 /tmp/librespeed-php.ini "$scan_dir/99-librespeed.ini"; \
  30. rm /tmp/librespeed-php.ini
  31. # Prepare files and folders
  32. RUN mkdir -p /speedtest/
  33. # Copy sources
  34. COPY backend/ /speedtest/backend
  35. COPY frontend/ /speedtest/frontend
  36. COPY results/*.php /speedtest/results/
  37. COPY results/*.ttf /speedtest/results/
  38. COPY *.js /speedtest/
  39. COPY index.html /speedtest/
  40. COPY index-classic.html /speedtest/
  41. COPY index-modern.html /speedtest/
  42. COPY config.json /speedtest/
  43. COPY stability.html /speedtest/
  44. COPY favicon.ico /speedtest/
  45. COPY manifest.webmanifest /speedtest/
  46. COPY images/ /speedtest/images/
  47. COPY docker/entrypoint.sh /
  48. # Prepare default environment variables
  49. ENV TITLE=LibreSpeed
  50. ENV TAGLINE="No Flash, No Java, No Websockets, No Bullsh*t"
  51. ENV MODE=standalone
  52. ENV PASSWORD=password
  53. ENV TELEMETRY=false
  54. ENV ENABLE_ID_OBFUSCATION=false
  55. ENV REDACT_IP_ADDRESSES=false
  56. ENV WEBPORT=8080
  57. ENV USE_NEW_DESIGN=false
  58. # https://httpd.apache.org/docs/2.4/stopping.html#gracefulstop
  59. STOPSIGNAL SIGWINCH
  60. # Add labels for better metadata
  61. LABEL org.opencontainers.image.title="LibreSpeed"
  62. LABEL org.opencontainers.image.description="A Free and Open Source speed test that you can host on your server(s)"
  63. LABEL org.opencontainers.image.vendor="LibreSpeed"
  64. LABEL org.opencontainers.image.url="https://github.com/librespeed/speedtest"
  65. LABEL org.opencontainers.image.source="https://github.com/librespeed/speedtest"
  66. LABEL org.opencontainers.image.documentation="https://github.com/librespeed/speedtest/blob/master/doc_docker.md"
  67. LABEL org.opencontainers.image.licenses="LGPL-3.0-or-later"
  68. # Add health check
  69. HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
  70. CMD wget --no-verbose --tries=1 --spider http://localhost:${WEBPORT}/ || exit 1
  71. WORKDIR /var/www/html
  72. # Final touches
  73. EXPOSE ${WEBPORT}
  74. CMD ["bash", "/entrypoint.sh"]