-
Notifications
You must be signed in to change notification settings - Fork 533
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The dynamic module of nginx cannot be configured #217
Comments
I see what you are saying. Besides the
You would like to inject some other text there, like a
I didn't actually test that, but it's the idea. You can also bind-mount your own |
Can docker-openresty support brotli compression? |
I see the module |
Offical docker image of PHP provides ENV like "PHPIZE_DEPS" and configured php sources, this make user build modules after base built possible:
|
Here's my demo Dockerfile for that Since we donot have DEPS and CONFIG env, so this is rather fragile: FROM openresty/openresty:1.21.4.1-4-rocky AS module-builder
# DONOT USE THIS IN PRODUCT!
WORKDIR /usr/src
RUN set -xeo pipefail ; \
dnf install -y git && \
wget https://openresty.org/download/openresty-1.21.4.1.tar.gz && \
mkdir openresty && \
tar --strip-components=1 -xf openresty-1.21.4.1.tar.gz -C openresty && \
git clone https://github.com/google/ngx_brotli /usr/src/ngx_brotli && \
git clone https://github.com/tokers/zstd-nginx-module /usr/src/zstd-nginx-module && \
:
RUN dnf install -yy epel-release && \
dnf install -yy ccache gcc make brotli-devel libzstd-devel \
# here we donot know which packages is used in building openresty
# so we have to dnf search and append "-devel" here
openresty-openssl111-devel openresty-pcre-devel openresty-zlib-devel
RUN set -xeo pipefail ; \
cd /usr/src/openresty/bundle/nginx-1.21.4 && \
# here we cannot get real configure args so we have to use nginx -V
# futhermore, --add-modules things make configure fail because wo donot have a "configurable" source for them
RESTY_CONFIG_OPTIONS="$(nginx -V 2>&1 | grep 'configure arguments:' | sed 's/^configure arguments://g' | sed -E 's/--add-module=[^ ]+ //g')" && \
eval "./configure $RESTY_CONFIG_OPTIONS --add-dynamic-module=/usr/src/ngx_brotli --add-dynamic-module=/usr/src/zstd-nginx-module" && \
make -j `nproc` modules && \
:
FROM openresty/openresty:1.21.4.1-4-rocky
RUN dnf install -yy brotli libzstd && \
dnf clean all
COPY --from=module-builder \
/usr/src/openresty/bundle/nginx-1.21.4/objs/ngx_http_brotli_filter_module.so \
/usr/src/openresty/bundle/nginx-1.21.4/objs/ngx_http_brotli_static_module.so \
/usr/src/openresty/bundle/nginx-1.21.4/objs/ngx_http_zstd_filter_module.so \
/usr/src/openresty/bundle/nginx-1.21.4/objs/ngx_http_zstd_static_module.so \
/usr/local/openresty/nginx/modules/ |
Brotli is dynamically compiled into a so file, and load_module /etc/nginx/ngx_http_brotli_filter_module.so; and load_module /etc/nginx/ngx_http_brotli_static_module.so are added at the beginning of nginx.conf
The text was updated successfully, but these errors were encountered: