Adds ngx_brotli module

This commit is contained in:
Jamie Curnow
2024-10-17 15:34:52 +10:00
parent 78572cc85e
commit 5d4df92e79
3 changed files with 30 additions and 1 deletions
+6
View File
@@ -11,6 +11,7 @@ ARG LUAROCKS_VERSION
RUN apt-get update \
&& apt-get install -y \
build-essential \
cmake \
ca-certificates \
libncurses-dev \
libpcre3-dev \
@@ -22,6 +23,10 @@ RUN apt-get update \
git \
libmaxminddb-dev
# brotli build
COPY ./scripts/build-brotli /tmp/build-brotli
RUN /tmp/build-brotli
# Lua build
COPY ./scripts/build-lua /tmp/build-lua
RUN /tmp/build-lua
@@ -70,6 +75,7 @@ COPY ./files/.bashrc /root/.bashrc
# Copy lua and luarocks builds from first image
COPY --from=nginxbuilder /tmp/lua /tmp/lua
COPY --from=nginxbuilder /tmp/ngx_brotli /tmp/ngx_brotli
COPY --from=nginxbuilder /tmp/luarocks /tmp/luarocks
COPY ./scripts/install-lua /tmp/install-lua
+21
View File
@@ -0,0 +1,21 @@
#!/bin/bash -e
BLUE='\E[1;34m'
CYAN='\E[1;36m'
YELLOW='\E[1;33m'
GREEN='\E[1;32m'
RESET='\E[0m'
echo -e "${BLUE} ${CYAN}Building brotli ${YELLOW}${LUA_VERSION}...${RESET}"
cd /tmp
git clone --recurse-submodules -j8 "https://github.com/google/ngx_brotli"
cd /tmp/ngx_brotli/deps/brotli
mkdir -p /tmp/ngx_brotli/deps/brotli/out
cd /tmp/ngx_brotli/deps/brotli/out
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DCMAKE_C_FLAGS="-Ofast -m64 -march=native -mtune=native -flto -funroll-loops -ffunction-sections -fdata-sections -Wl,--gc-sections" -DCMAKE_CXX_FLAGS="-Ofast -m64 -march=native -mtune=native -flto -funroll-loops -ffunction-sections -fdata-sections -Wl,--gc-sections" -DCMAKE_INSTALL_PREFIX=./installed ..
cmake --build . --config Release --target brotlienc
echo -e "${BLUE} ${GREEN}brotli build completed${RESET}"
+3 -1
View File
@@ -12,6 +12,7 @@ cd /tmp
wget "https://openresty.org/download/openresty-${OPENRESTY_VERSION}.tar.gz"
tar -xzf openresty-${OPENRESTY_VERSION}.tar.gz
mv /tmp/openresty-${OPENRESTY_VERSION} /tmp/openresty
git clone https://github.com/leev/ngx_http_geoip2_module.git
mv /tmp/ngx_http_geoip2_module /tmp/openresty/ngx_http_geoip2_module
cd /tmp/openresty
@@ -55,7 +56,8 @@ cd /tmp/openresty
--with-stream_realip_module \
--with-stream_ssl_module \
--with-stream_ssl_preread_module \
--add-dynamic-module=/tmp/openresty/ngx_http_geoip2_module
--add-dynamic-module=/tmp/openresty/ngx_http_geoip2_module \
--add-module=/tmp/ngx_brotli
make -j2