Dockerfile.alpine 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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 frontend/ /speedtest/frontend
  33. COPY results/*.php /speedtest/results/
  34. COPY results/*.ttf /speedtest/results/
  35. COPY *.js /speedtest/
  36. COPY favicon.ico /speedtest/
  37. COPY docker/servers.json /servers.json
  38. COPY docker/*.php /speedtest/
  39. COPY docker/entrypoint.sh /
  40. # Prepare default environment variables
  41. ENV TITLE=LibreSpeed
  42. ENV MODE=standalone
  43. ENV PASSWORD=password
  44. ENV TELEMETRY=false
  45. ENV ENABLE_ID_OBFUSCATION=false
  46. ENV REDACT_IP_ADDRESSES=false
  47. ENV WEBPORT=8080
  48. # https://httpd.apache.org/docs/2.4/stopping.html#gracefulstop
  49. STOPSIGNAL SIGWINCH
  50. # Add labels for better metadata
  51. LABEL org.opencontainers.image.title="LibreSpeed"
  52. LABEL org.opencontainers.image.description="A Free and Open Source speed test that you can host on your server(s)"
  53. LABEL org.opencontainers.image.vendor="LibreSpeed"
  54. LABEL org.opencontainers.image.url="https://github.com/librespeed/speedtest"
  55. LABEL org.opencontainers.image.source="https://github.com/librespeed/speedtest"
  56. LABEL org.opencontainers.image.documentation="https://github.com/librespeed/speedtest/blob/master/doc_docker.md"
  57. LABEL org.opencontainers.image.licenses="LGPL-3.0-or-later"
  58. # Add health check
  59. HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
  60. CMD wget --no-verbose --tries=1 --spider http://localhost:${WEBPORT}/ || exit 1
  61. WORKDIR /var/www/html
  62. # Final touches
  63. EXPOSE ${WEBPORT}
  64. CMD ["bash", "/entrypoint.sh"]