Dockerfile.alpine 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. FROM alpine:3.23
  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. # Use PHP's scan dir without pinning the apk PHP major.
  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 docker/entrypoint.sh /
  46. # Prepare default environment variables
  47. ENV TITLE=LibreSpeed
  48. ENV TAGLINE="No Flash, No Java, No Websockets, No Bullsh*t"
  49. ENV MODE=standalone
  50. ENV PASSWORD=password
  51. ENV TELEMETRY=false
  52. ENV ENABLE_ID_OBFUSCATION=false
  53. ENV REDACT_IP_ADDRESSES=false
  54. ENV WEBPORT=8080
  55. ENV USE_NEW_DESIGN=false
  56. # https://httpd.apache.org/docs/2.4/stopping.html#gracefulstop
  57. STOPSIGNAL SIGWINCH
  58. # Add labels for better metadata
  59. LABEL org.opencontainers.image.title="LibreSpeed"
  60. LABEL org.opencontainers.image.description="A Free and Open Source speed test that you can host on your server(s)"
  61. LABEL org.opencontainers.image.vendor="LibreSpeed"
  62. LABEL org.opencontainers.image.url="https://github.com/librespeed/speedtest"
  63. LABEL org.opencontainers.image.source="https://github.com/librespeed/speedtest"
  64. LABEL org.opencontainers.image.documentation="https://github.com/librespeed/speedtest/blob/master/doc_docker.md"
  65. LABEL org.opencontainers.image.licenses="LGPL-3.0-or-later"
  66. # Add health check
  67. HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
  68. CMD wget --no-verbose --tries=1 --spider http://localhost:${WEBPORT}/ || exit 1
  69. WORKDIR /var/www/html
  70. # Final touches
  71. EXPOSE ${WEBPORT}
  72. CMD ["bash", "/entrypoint.sh"]