1
0

Dockerfile 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. FROM php:8-apache
  2. # use docker-php-extension-installer for automatically get the right packages installed
  3. ADD --chmod=0755 https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
  4. # Install extensions and cleanup in a single layer to reduce image size
  5. RUN install-php-extensions iconv gd pdo pdo_mysql pdo_pgsql pgsql \
  6. && rm -f /usr/src/php.tar.xz /usr/src/php.tar.xz.asc \
  7. && apt-get autoremove -y \
  8. && apt-get clean \
  9. && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
  10. # PHP_INI_DIR is set by the official php:8-apache image to /usr/local/etc/php
  11. # and has been stable across PHP majors. Using the env var documents intent
  12. # and follows any future upstream change to the path automatically.
  13. COPY docker/librespeed-php.ini ${PHP_INI_DIR}/conf.d/99-librespeed.ini
  14. # Prepare files and folders
  15. RUN mkdir -p /speedtest/
  16. # Copy sources
  17. COPY backend/ /speedtest/backend
  18. COPY frontend/ /speedtest/frontend
  19. COPY results/*.php /speedtest/results/
  20. COPY results/*.ttf /speedtest/results/
  21. COPY *.js /speedtest/
  22. COPY index.html /speedtest/
  23. COPY index-classic.html /speedtest/
  24. COPY index-modern.html /speedtest/
  25. COPY config.json /speedtest/
  26. COPY stability.html /speedtest/
  27. COPY favicon.ico /speedtest/
  28. COPY docker/entrypoint.sh /
  29. # Prepare default environment variables
  30. ENV TITLE=LibreSpeed
  31. ENV TAGLINE="No Flash, No Java, No Websockets, No Bullsh*t"
  32. ENV MODE=standalone
  33. ENV PASSWORD=password
  34. ENV TELEMETRY=false
  35. ENV ENABLE_ID_OBFUSCATION=false
  36. ENV REDACT_IP_ADDRESSES=false
  37. ENV WEBPORT=8080
  38. ENV USE_NEW_DESIGN=false
  39. # https://httpd.apache.org/docs/2.4/stopping.html#gracefulstop
  40. STOPSIGNAL SIGWINCH
  41. # Add labels for better metadata
  42. LABEL org.opencontainers.image.title="LibreSpeed"
  43. LABEL org.opencontainers.image.description="A Free and Open Source speed test that you can host on your server(s)"
  44. LABEL org.opencontainers.image.vendor="LibreSpeed"
  45. LABEL org.opencontainers.image.url="https://github.com/librespeed/speedtest"
  46. LABEL org.opencontainers.image.source="https://github.com/librespeed/speedtest"
  47. LABEL org.opencontainers.image.documentation="https://github.com/librespeed/speedtest/blob/master/doc_docker.md"
  48. LABEL org.opencontainers.image.licenses="LGPL-3.0-or-later"
  49. # Add health check
  50. HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
  51. CMD curl -f http://localhost:${WEBPORT}/ || exit 1
  52. # Final touches
  53. EXPOSE ${WEBPORT}
  54. CMD ["bash", "/entrypoint.sh"]