From 8a2674626ad08a235f459f426e0d7ff851ee9526 Mon Sep 17 00:00:00 2001 From: Kris Lamoureux Date: Sat, 29 Oct 2022 18:20:13 -0400 Subject: [PATCH] Build ngx_set_misc nginx module in Dockerfile --- .gitignore | 1 + Dockerfile | 30 ++++++++++++++++++++++++++++++ LICENSE | 12 ++++++++++++ Makefile | 8 ++++++++ 4 files changed, 51 insertions(+) create mode 100644 .gitignore create mode 100644 Dockerfile create mode 100644 LICENSE create mode 100644 Makefile diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6caf68a --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +output \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..627e5f8 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,30 @@ +FROM debian:11 AS build + +RUN apt-get update && apt-get install -y \ + curl \ + git \ + build-essential \ + libssl-dev \ + zlib1g-dev \ + libpcre3 libpcre3-dev \ + && rm -rf /var/lib/apt/lists/* + +RUN mkdir /src /output +WORKDIR /src +RUN curl -s https://nginx.org/download/nginx-1.18.0.tar.gz | tar -xzC . +RUN git clone --no-checkout https://github.com/openresty/set-misc-nginx-module && \ + cd set-misc-nginx-module && \ + git checkout v0.33 && cd - +RUN git clone https://github.com/vision5/ngx_devel_kit/ && \ + cd ngx_devel_kit && \ + git checkout v0.3.1 && cd - + +WORKDIR /src/nginx-1.18.0 +RUN ./configure --with-http_ssl_module \ + --add-dynamic-module=/src/ngx_devel_kit \ + --add-dynamic-module=/src/set-misc-nginx-module && \ + make -j2 && \ + make install + +FROM scratch AS artifacts +COPY --from=build /usr/local/nginx/modules/ / diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..196e2f4 --- /dev/null +++ b/LICENSE @@ -0,0 +1,12 @@ +Copyright (C) 2022 by Kris Lamoureux + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..c261f88 --- /dev/null +++ b/Makefile @@ -0,0 +1,8 @@ +all: ngx_http_set_misc_module.so + +ngx_http_set_misc_module.so: export DOCKER_BUILDKIT=1 +ngx_http_set_misc_module.so: + docker build --no-cache --output type=local,dest=output . + +clean: + rm -rf output