Dockerfile.alpine 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. FROM alpine:3.18
  2. # Use Alpine packages (php8-*) and apache2. Explicit php8 package names
  3. # avoid conflicts and improve multi-arch compatibility.
  4. RUN apk add --quiet --no-cache \
  5. bash \
  6. apache2 \
  7. wget \
  8. php8 \
  9. php8-apache2 \
  10. php8-ctype \
  11. php8-phar \
  12. php8-gd \
  13. php8-openssl \
  14. php8-pdo \
  15. php8-pdo_mysql \
  16. php8-pdo_pgsql \
  17. php8-pdo_sqlite \
  18. php8-pgsql \
  19. php8-session \
  20. php8-sqlite3
  21. # Note: PHP extensions are provided via Alpine `php-*` packages above.
  22. # The docker-php-extension-installer is redundant when using those packages,
  23. # so it's intentionally removed to simplify the image.
  24. RUN ln -sf /dev/stdout /var/log/apache2/access.log && \
  25. ln -sf /dev/stderr /var/log/apache2/error.log
  26. # Prepare files and folders
  27. RUN mkdir -p /speedtest/
  28. # Copy sources
  29. COPY backend/ /speedtest/backend
  30. COPY results/*.php /speedtest/results/
  31. COPY results/*.ttf /speedtest/results/
  32. COPY *.js /speedtest/
  33. COPY favicon.ico /speedtest/
  34. COPY docker/servers.json /servers.json
  35. COPY docker/*.php /speedtest/
  36. COPY docker/entrypoint.sh /
  37. # Prepare default environment variables
  38. ENV TITLE=LibreSpeed
  39. ENV MODE=standalone
  40. ENV PASSWORD=password
  41. ENV TELEMETRY=false
  42. ENV ENABLE_ID_OBFUSCATION=false
  43. ENV REDACT_IP_ADDRESSES=false
  44. ENV WEBPORT=8080
  45. # https://httpd.apache.org/docs/2.4/stopping.html#gracefulstop
  46. STOPSIGNAL SIGWINCH
  47. # Add labels for better metadata
  48. LABEL org.opencontainers.image.title="LibreSpeed"
  49. LABEL org.opencontainers.image.description="A Free and Open Source speed test that you can host on your server(s)"
  50. LABEL org.opencontainers.image.vendor="LibreSpeed"
  51. LABEL org.opencontainers.image.url="https://github.com/librespeed/speedtest"
  52. LABEL org.opencontainers.image.source="https://github.com/librespeed/speedtest"
  53. LABEL org.opencontainers.image.documentation="https://github.com/librespeed/speedtest/blob/master/doc_docker.md"
  54. LABEL org.opencontainers.image.licenses="LGPL-3.0-or-later"
  55. # Add health check
  56. HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
  57. CMD wget --no-verbose --tries=1 --spider http://localhost:${WEBPORT}/ || exit 1
  58. WORKDIR /var/www/html
  59. # Final touches
  60. EXPOSE ${WEBPORT}
  61. CMD ["bash", "/entrypoint.sh"]