Dockerfile 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. COPY docker/librespeed-php.ini ${PHP_INI_DIR}/conf.d/99-librespeed.ini
  11. # Prepare files and folders
  12. RUN mkdir -p /speedtest/
  13. # Copy sources
  14. COPY backend/ /speedtest/backend
  15. COPY frontend/ /speedtest/frontend
  16. COPY results/*.php /speedtest/results/
  17. COPY results/*.ttf /speedtest/results/
  18. COPY *.js /speedtest/
  19. COPY index.html /speedtest/
  20. COPY index-classic.html /speedtest/
  21. COPY index-modern.html /speedtest/
  22. COPY config.json /speedtest/
  23. COPY stability.html /speedtest/
  24. COPY favicon.ico /speedtest/
  25. COPY manifest.webmanifest /speedtest/
  26. COPY images/ /speedtest/images/
  27. COPY docker/entrypoint.sh /
  28. # Prepare default environment variables
  29. ENV TITLE=LibreSpeed
  30. ENV TAGLINE="No Flash, No Java, No Websockets, No Bullsh*t"
  31. ENV MODE=standalone
  32. ENV PASSWORD=password
  33. ENV TELEMETRY=false
  34. ENV ENABLE_ID_OBFUSCATION=false
  35. ENV REDACT_IP_ADDRESSES=false
  36. ENV WEBPORT=8080
  37. ENV USE_NEW_DESIGN=false
  38. # https://httpd.apache.org/docs/2.4/stopping.html#gracefulstop
  39. STOPSIGNAL SIGWINCH
  40. # Add labels for better metadata
  41. LABEL org.opencontainers.image.title="LibreSpeed"
  42. LABEL org.opencontainers.image.description="A Free and Open Source speed test that you can host on your server(s)"
  43. LABEL org.opencontainers.image.vendor="LibreSpeed"
  44. LABEL org.opencontainers.image.url="https://github.com/librespeed/speedtest"
  45. LABEL org.opencontainers.image.source="https://github.com/librespeed/speedtest"
  46. LABEL org.opencontainers.image.documentation="https://github.com/librespeed/speedtest/blob/master/doc_docker.md"
  47. LABEL org.opencontainers.image.licenses="LGPL-3.0-or-later"
  48. # Add health check
  49. HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
  50. CMD curl -f http://localhost:${WEBPORT}/ || exit 1
  51. # Final touches
  52. EXPOSE ${WEBPORT}
  53. CMD ["bash", "/entrypoint.sh"]