Dockerfile 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. FROM alpine
  2. # This chunk copied from https://github.com/duxlong/webdav/blob/main/Dockerfile
  3. RUN apk update && \
  4. apk add --no-cache pcre libxml2 libxslt apache2-utils \
  5. gcc make libc-dev pcre-dev zlib-dev libxml2-dev libxslt-dev && \
  6. cd /tmp && \
  7. wget https://github.com/nginx/nginx/archive/refs/tags/release-1.23.1.zip -O nginx.zip && \
  8. unzip nginx.zip && \
  9. wget https://github.com/arut/nginx-dav-ext-module/archive/refs/tags/v3.0.0.zip -O dav-ext-module.zip && \
  10. unzip dav-ext-module.zip && \
  11. wget https://github.com/aperezdc/ngx-fancyindex/archive/refs/tags/v0.5.2.zip -O ngx-fancyindex.zip && \
  12. unzip ngx-fancyindex.zip && \
  13. cd nginx-release-1.23.1 && \
  14. ./auto/configure --prefix=/opt/nginx --with-http_dav_module --add-module=/tmp/nginx-dav-ext-module-3.0.0 --add-module=/tmp/ngx-fancyindex-0.5.2 && \
  15. make && make install && \
  16. cd /root && \
  17. apk del gcc make libc-dev pcre-dev zlib-dev libxml2-dev libxslt-dev && \
  18. rm -rf /var/cache/apk/* && \
  19. rm -rf /tmp/*
  20. EXPOSE 80
  21. RUN apk -U upgrade && \
  22. apk add --no-cache curl && \
  23. mkdir -p /var/www/html && \
  24. mkdir -p /var/www/conf && \
  25. \
  26. # add images
  27. for i in 0 1 2 3 4 5 6 7 8 9; do \
  28. while ! curl -m 2 -L -o "/var/www/html/$i.jpg" "https://picsum.photos/1280/960"; do \
  29. sleep 1; \
  30. done \
  31. done && \
  32. \
  33. # add transparent png
  34. while ! curl -m 2 -o /var/www/html/transparent-test.png "https://www.w3.org/Graphics/PNG/alphatest.png"; do \
  35. sleep 1; \
  36. done && \
  37. \
  38. # add fonts
  39. for font in notoserif/NotoSerif-Regular.ttf unlock/Unlock-Regular.ttf blackandwhitepicture/BlackAndWhitePicture-Regular.ttf indieflower/IndieFlower-Regular.ttf; do \
  40. while ! curl -m 10 -L -o "/var/www/html/$(basename $font)" "https://cdn.jsdelivr.net/gh/google/fonts/ofl/$font"; do \
  41. sleep 1; \
  42. done \
  43. done && \
  44. \
  45. # add video
  46. while ! curl -m 10 -L -o /var/www/html/video.mp4 "https://ik.imagekit.io/demo/sample-video.mp4"; do \
  47. sleep 1; \
  48. done && \
  49. \
  50. # add PDF
  51. while ! curl -m 2 -L -o /var/www/html/dummy.pdf "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"; do \
  52. sleep 1; \
  53. done && \
  54. \
  55. # create som inaccessible files for testing
  56. mkdir -p /var/www/html/inaccessible-dir && \
  57. \
  58. while ! curl -m 2 -L -o /var/www/html/inaccessible-image.jpg "https://picsum.photos/1280/960"; do \
  59. sleep 1; \
  60. done && \
  61. \
  62. echo 'Lorem ipsum dolor sit amet' > /var/www/html/inaccessible-text-file.txt && \
  63. > /var/www/html/inaccessible-file && \
  64. \
  65. # set ownership properly
  66. chown -R daemon:daemon /var/www && \
  67. chown nobody:nobody /var/www/html/inaccessible* && \
  68. chmod 700 /var/www/html/inaccessible* && \
  69. \
  70. # clean up
  71. apk del curl;
  72. ENTRYPOINT ["/opt/nginx/sbin/nginx", "-g", "daemon off;"]
  73. EXPOSE 80