Dockerfile.alpine 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. FROM alpine:3.23
  2. RUN apk add --quiet --no-cache \
  3. bash \
  4. apache2 \
  5. ca-certificates \
  6. php \
  7. php-apache2 \
  8. php-ctype \
  9. php-phar \
  10. php-gd \
  11. php-openssl \
  12. php-pdo \
  13. php-pdo_mysql \
  14. php-pdo_pgsql \
  15. php-pdo_sqlite \
  16. php-pgsql \
  17. php-session \
  18. php-sqlite3
  19. RUN ln -sf /dev/stdout /var/log/apache2/access.log && \
  20. ln -sf /dev/stderr /var/log/apache2/error.log
  21. COPY docker/librespeed-php.ini /tmp/librespeed-php.ini
  22. RUN scan_dir="$(/usr/bin/php -r 'echo rtrim(PHP_CONFIG_FILE_SCAN_DIR);')" \
  23. && [ -n "$scan_dir" ] \
  24. && install -D -m 0644 /tmp/librespeed-php.ini "$scan_dir/99-librespeed.ini" \
  25. && rm /tmp/librespeed-php.ini
  26. # Prepare files and folders
  27. RUN mkdir -p /speedtest/
  28. # Copy sources
  29. COPY backend/ /speedtest/backend
  30. COPY frontend/ /speedtest/frontend
  31. COPY results/*.php /speedtest/results/
  32. COPY results/*.ttf /speedtest/results/
  33. COPY *.js /speedtest/
  34. COPY index.html /speedtest/
  35. COPY index-classic.html /speedtest/
  36. COPY index-modern.html /speedtest/
  37. COPY config.json /speedtest/
  38. COPY stability.html /speedtest/
  39. COPY favicon.ico /speedtest/
  40. COPY docker/entrypoint.sh /
  41. # Prepare default environment variables
  42. ENV TITLE=LibreSpeed
  43. ENV TAGLINE="No Flash, No Java, No Websockets, No Bullsh*t"
  44. ENV MODE=standalone
  45. ENV PASSWORD=password
  46. ENV TELEMETRY=false
  47. ENV ENABLE_ID_OBFUSCATION=false
  48. ENV REDACT_IP_ADDRESSES=false
  49. ENV WEBPORT=8080
  50. ENV USE_NEW_DESIGN=false
  51. # https://httpd.apache.org/docs/2.4/stopping.html#gracefulstop
  52. STOPSIGNAL SIGWINCH
  53. # Add labels for better metadata
  54. LABEL org.opencontainers.image.title="LibreSpeed"
  55. LABEL org.opencontainers.image.description="A Free and Open Source speed test that you can host on your server(s)"
  56. LABEL org.opencontainers.image.vendor="LibreSpeed"
  57. LABEL org.opencontainers.image.url="https://github.com/librespeed/speedtest"
  58. LABEL org.opencontainers.image.source="https://github.com/librespeed/speedtest"
  59. LABEL org.opencontainers.image.documentation="https://github.com/librespeed/speedtest/blob/master/doc_docker.md"
  60. LABEL org.opencontainers.image.licenses="LGPL-3.0-or-later"
  61. # Add health check
  62. HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
  63. CMD wget --no-verbose --tries=1 --spider http://localhost:${WEBPORT}/ || exit 1
  64. WORKDIR /var/www/html
  65. # Final touches
  66. EXPOSE ${WEBPORT}
  67. CMD ["bash", "/entrypoint.sh"]