Comments (5)
I see what you are saying. Besides the http
section, the main
stanza is currently:
pcre_jit on;
events {
worker_connections 1024;
}
You would like to inject some other text there, like a load_module
line. We do let you alter the build process with Docker build arguments, like RESTY_EVAL_POST_MAKE
. So you could use that arg to do something like:
docker build --build-arg RESTY_EVAL_POST_MAKE="echo 'load_module /etc/nginx/ngx_http_brotli_filter_module.so; load_module /etc/nginx/ngx_http_brotli_static_module.so;' >> /usr/local/openresty/nginx/conf/nginx.conf" -f focal/Dockerfile .
I didn't actually test that, but it's the idea.
You can also bind-mount your own nginx.conf
to /usr/local/openresty/nginx/conf/nginx.conf
. You are also bind-mounting the shared-objects or building it in a derived image?
from docker-openresty.
Can docker-openresty support brotli compression?
from docker-openresty.
I see the module ngx_brotli
. Is there any reason this isn't already in Nginx or OpenResty already? I generally don't add modules, but maybe we can add it to the -fat
images?
from docker-openresty.
Offical docker image of PHP provides ENV like "PHPIZE_DEPS" and configured php sources, this make user build modules after base built possible:
- base image provides ENV like configure arguments, build deps
- base image provides configured sources and tar it, save it to /usr/src
- when use FROM that base image, user can use
distro_pm_like_apk add $BUILD_DEPS
install build deps, thentar -xf /usr/src/configured.tar.zst -C /usr/src/openresty
and cd into it, make their own modules./configure $CONFIG_THINGS --add-dynamic-module=/path/to/whatever
- after that, user can copy modules from that stage or
distro_pm_like_apk del $BUILD_DEPS
- at last, user install running deps like libbrotlidec for ngx-brotli
from docker-openresty.
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/
from docker-openresty.
Related Issues (20)
- 你的微信号多少,发我邮箱
- ngx_http_upstream_check_module无法添加模块 HOT 1
- fedora aarch64 builds failing HOT 1
- Add Debian 12 `bookworm` release HOT 7
- Upgrade OpenSSL to 1.1.1u HOT 3
- image for new release v1.21.4.2 HOT 7
- Upgrade to openssl 3.0 HOT 1
- HTTP2 Rapid Reset Mitigation HOT 3
- Can't load the cjson module into luajit CLI HOT 1
- Update debian and other images HOT 1
- Builds for Debian 11 and 12 are broken HOT 2
- Image for new release 1.25.3.1 HOT 3
- Adding Third Party Modules to Debian Images Utilizing the ".deb" Installation
- OpenSSL 1.1.1x for CVE-2023-5678 HOT 3
- environment variable injected by docker compose is not available in openresty process HOT 2
- RHEL support for openresty HOT 2
- luajit: unknown luaJIT command or jit.* modules not installed HOT 3
- Rebuild image tag "alpine" CVE-2024-25062 HOT 1
- [emerg] 1#1: mkdir() "/var/run/openresty/nginx-client-body" failed HOT 2
- Add Ubuntu 24 support HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docker-openresty.