Dockerfile 2.0 KB

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