From aeea21ad11a681b794ebe21bda485938cffe5f12 Mon Sep 17 00:00:00 2001 From: Dominic Ricottone Date: Mon, 7 Aug 2023 17:50:23 -0500 Subject: [PATCH] Adding a WebDAV variant of Nginx --- .gitmodules | 3 +++ nginx/Dockerfile.webdav | 23 +++++++++++++++++++++++ nginx/Makefile | 17 +++++++++++++---- nginx/README.md | 1 + nginx/nginx-dav-ext-module | 1 + 5 files changed, 41 insertions(+), 4 deletions(-) create mode 100644 nginx/Dockerfile.webdav create mode 160000 nginx/nginx-dav-ext-module diff --git a/.gitmodules b/.gitmodules index 67bf4f2..302f6a5 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "nitter/src"] path = nitter/src url = https://github.com/PrivacyDevel/nitter +[submodule "nginx/nginx-dav-ext-module"] + path = nginx/nginx-dav-ext-module + url = https://github.com/arut/nginx-dav-ext-module diff --git a/nginx/Dockerfile.webdav b/nginx/Dockerfile.webdav new file mode 100644 index 0000000..5229c2c --- /dev/null +++ b/nginx/Dockerfile.webdav @@ -0,0 +1,23 @@ +FROM docker.io/library/nginx:alpine as builder + +COPY nginx-dav-ext-module /nginx-dav-ext-module + +RUN curl -o /nginx.tar.gz https://nginx.org/download/nginx-$(apk list -i nginx 2>/dev/null | sed 's/^nginx-\([0-9.]\+\)-.*$/\1/').tar.gz \ + && cd / \ + && tar -xzf /nginx.tar.gz \ + && mv /nginx-$(apk list -i nginx 2>/dev/null | sed 's/^nginx-\([0-9.]\+\)-.*$/\1/') /nginx + +RUN apk add --no-cache linux-headers openssl-dev pcre2-dev zlib-dev openssl abuild musl-dev libxslt-dev libxml2-utils make gcc unzip xz g++ coreutils \ + && cd /nginx \ + && ./configure --with-compat --with-http_dav_module --add-dynamic-module=/nginx-dav-ext-module \ + && make modules + +FROM docker.io/library/nginx:alpine + +COPY --from=builder /nginx/objs/ngx_http_dav_ext_module.so /etc/nginx/modules/ + +RUN echo "load_module modules/ngx_http_dav_ext_module.so;" > /etc/nginx/modules/ngx_http_dav_ext_module.conf + +COPY *.conf /etc/nginx/ +COPY error_pages.d/ /etc/nginx/conf.d/error_pages.d/ + diff --git a/nginx/Makefile b/nginx/Makefile index abf44d3..e38a6c4 100644 --- a/nginx/Makefile +++ b/nginx/Makefile @@ -2,12 +2,21 @@ CONMAN=sudo docker REGISTRY=registry.intra.dominic-ricottone.com IMAGE=nginx -TAG=latest +TAG_HTTP=latest +TAG_WEBDAV=webdav -image: +image: image-http image-webdav + +image-http: $(CONMAN) buildx build --push \ --platform linux/arm64,linux/amd64 \ - --tag $(REGISTRY)/$(IMAGE):$(TAG) \ + --tag $(REGISTRY)/$(IMAGE):$(TAG_HTTP) \ . -.PHONY: image +image-webdav: + $(CONMAN) buildx build --push \ + --platform linux/arm64,linux/amd64 \ + --tag $(REGISTRY)/$(IMAGE):$(TAG_WEBDAV) \ + . -f Dockerfile.webdav + +.PHONY: image image-http image-webdav diff --git a/nginx/README.md b/nginx/README.md index 425270a..a84d2e7 100644 --- a/nginx/README.md +++ b/nginx/README.md @@ -11,6 +11,7 @@ make image ### Tags + `latest` + + `webdav` for WebDAV support ---- diff --git a/nginx/nginx-dav-ext-module b/nginx/nginx-dav-ext-module new file mode 160000 index 0000000..f5e3088 --- /dev/null +++ b/nginx/nginx-dav-ext-module @@ -0,0 +1 @@ +Subproject commit f5e30888a256136d9c550bf1ada77d6ea78a48af -- 2.45.2