Dockerfile 1.9 KB

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