Dockerfile.alpine 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. FROM php:8-alpine
  2. # Use the mlocati helper to install PHP extensions in a platform-agnostic way.
  3. ADD --chmod=0755 https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
  4. # Install runtime packages and let the helper install/compile PHP extensions
  5. RUN apk add --quiet --no-cache \
  6. bash \
  7. apache2 \
  8. wget \
  9. curl \
  10. build-base \
  11. autoconf \
  12. libpng-dev \
  13. libjpeg-turbo-dev \
  14. libwebp-dev \
  15. freetype-dev \
  16. libxml2-dev \
  17. mariadb-connector-c-dev \
  18. postgresql-dev \
  19. sqlite-dev \
  20. && install-php-extensions iconv gd pdo pdo_mysql pdo_pgsql pdo_sqlite pgsql zip \
  21. && apk del .build-deps
  22. # Note: PHP extensions are provided via Alpine `php-*` packages above.
  23. # The docker-php-extension-installer is redundant when using those packages,
  24. # so it's intentionally removed to simplify the image.
  25. RUN ln -sf /dev/stdout /var/log/apache2/access.log && \
  26. ln -sf /dev/stderr /var/log/apache2/error.log
  27. # Prepare files and folders
  28. RUN mkdir -p /speedtest/
  29. # Copy sources
  30. COPY backend/ /speedtest/backend
  31. COPY results/*.php /speedtest/results/
  32. COPY results/*.ttf /speedtest/results/
  33. COPY *.js /speedtest/
  34. COPY favicon.ico /speedtest/
  35. COPY docker/servers.json /servers.json
  36. COPY docker/*.php /speedtest/
  37. COPY docker/entrypoint.sh /
  38. # Prepare default environment variables
  39. ENV TITLE=LibreSpeed
  40. ENV MODE=standalone
  41. ENV PASSWORD=password
  42. ENV TELEMETRY=false
  43. ENV ENABLE_ID_OBFUSCATION=false
  44. ENV REDACT_IP_ADDRESSES=false
  45. ENV WEBPORT=8080
  46. # https://httpd.apache.org/docs/2.4/stopping.html#gracefulstop
  47. STOPSIGNAL SIGWINCH
  48. # Add labels for better metadata
  49. LABEL org.opencontainers.image.title="LibreSpeed"
  50. LABEL org.opencontainers.image.description="A Free and Open Source speed test that you can host on your server(s)"
  51. LABEL org.opencontainers.image.vendor="LibreSpeed"
  52. LABEL org.opencontainers.image.url="https://github.com/librespeed/speedtest"
  53. LABEL org.opencontainers.image.source="https://github.com/librespeed/speedtest"
  54. LABEL org.opencontainers.image.documentation="https://github.com/librespeed/speedtest/blob/master/doc_docker.md"
  55. LABEL org.opencontainers.image.licenses="LGPL-3.0-or-later"
  56. # Add health check
  57. HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
  58. CMD wget --no-verbose --tries=1 --spider http://localhost:${WEBPORT}/ || exit 1
  59. WORKDIR /var/www/html
  60. # Final touches
  61. EXPOSE ${WEBPORT}
  62. CMD ["bash", "/entrypoint.sh"]