Dockerfile.alpine 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. # Alpine installs PHP from apk; php-apache2 reads /etc/phpXX/conf.d.
  22. # Use the versioned apk conf.d without pinning the PHP major.
  23. COPY docker/librespeed-php.ini /tmp/librespeed-php.ini
  24. RUN set -eu; \
  25. scan_dir=""; \
  26. for d in /etc/php*/conf.d; do \
  27. [ -d "$d" ] && scan_dir="$d" && break; \
  28. done; \
  29. if [ -z "$scan_dir" ]; then \
  30. echo "ERROR: no /etc/php*/conf.d directory found; apk php-apache2 install layout may have changed" >&2; \
  31. exit 1; \
  32. fi; \
  33. install -D -m 0644 /tmp/librespeed-php.ini "$scan_dir/99-librespeed.ini"; \
  34. rm /tmp/librespeed-php.ini
  35. # Prepare files and folders
  36. RUN mkdir -p /speedtest/
  37. # Copy sources
  38. COPY backend/ /speedtest/backend
  39. COPY frontend/ /speedtest/frontend
  40. COPY results/*.php /speedtest/results/
  41. COPY results/*.ttf /speedtest/results/
  42. COPY *.js /speedtest/
  43. COPY index.html /speedtest/
  44. COPY index-classic.html /speedtest/
  45. COPY index-modern.html /speedtest/
  46. COPY config.json /speedtest/
  47. COPY stability.html /speedtest/
  48. COPY favicon.ico /speedtest/
  49. COPY docker/entrypoint.sh /
  50. # Prepare default environment variables
  51. ENV TITLE=LibreSpeed
  52. ENV TAGLINE="No Flash, No Java, No Websockets, No Bullsh*t"
  53. ENV MODE=standalone
  54. ENV PASSWORD=password
  55. ENV TELEMETRY=false
  56. ENV ENABLE_ID_OBFUSCATION=false
  57. ENV REDACT_IP_ADDRESSES=false
  58. ENV WEBPORT=8080
  59. ENV USE_NEW_DESIGN=false
  60. # https://httpd.apache.org/docs/2.4/stopping.html#gracefulstop
  61. STOPSIGNAL SIGWINCH
  62. # Add labels for better metadata
  63. LABEL org.opencontainers.image.title="LibreSpeed"
  64. LABEL org.opencontainers.image.description="A Free and Open Source speed test that you can host on your server(s)"
  65. LABEL org.opencontainers.image.vendor="LibreSpeed"
  66. LABEL org.opencontainers.image.url="https://github.com/librespeed/speedtest"
  67. LABEL org.opencontainers.image.source="https://github.com/librespeed/speedtest"
  68. LABEL org.opencontainers.image.documentation="https://github.com/librespeed/speedtest/blob/master/doc_docker.md"
  69. LABEL org.opencontainers.image.licenses="LGPL-3.0-or-later"
  70. # Add health check
  71. HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
  72. CMD wget --no-verbose --tries=1 --spider http://localhost:${WEBPORT}/ || exit 1
  73. WORKDIR /var/www/html
  74. # Final touches
  75. EXPOSE ${WEBPORT}
  76. CMD ["bash", "/entrypoint.sh"]