1
0

Dockerfile.alpine 2.5 KB

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