Dockerfile 2.4 KB

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