Skip to content

Commit

Permalink
Complile the zstd module and update the readme file
Browse files Browse the repository at this point in the history
  • Loading branch information
macbre committed Nov 25, 2024
2 parents 2d706b2 + 88dedd4 commit 3f3af29
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
21 changes: 10 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ RUN \
readline-dev \
zlib-dev \
&& apk add --no-cache --virtual .zstd-build-deps \
zstd-dev
zstd-dev \
&& git config --global init.defaultBranch master

WORKDIR /usr/src/

Expand Down Expand Up @@ -181,31 +182,29 @@ RUN \
echo "Downloading zstd-nginx-module ..." \
&& git clone --depth 1 --branch ${ZSTD_VERSION} https://github.com/tokers/zstd-nginx-module.git /usr/src/zstd


RUN \
echo "Cloning and configuring quickjs ..." \
&& mkdir -p /usr/src/njs \
&& cd /usr/src/njs \
&& cd /usr/src \
&& git clone https://github.com/bellard/quickjs quickjs \
&& cd quickjs \
&& make -j"$(getconf _NPROCESSORS_ONLN)" libquickjs.a

&& make libquickjs.a \
&& echo "quickjs $(cat VERSION)"

RUN \
echo "Cloning and configuring njs ..." \
&& mkdir -p /usr/src/njs \
&& cd /usr/src/njs \
&& mkdir /usr/src/njs && cd /usr/src/njs \
&& git init \
&& git remote add origin https://github.com/nginx/njs.git \
&& git fetch --depth 1 origin ${NJS_COMMIT} \
&& git checkout -q FETCH_HEAD \
&& ./configure --cc-opt='-Iquickjs' --ld-opt="-Lquickjs" \
&& ./configure --cc-opt='-I /usr/src/quickjs' --ld-opt="-L /usr/src/quickjs" \
&& make njs \
&& mv /usr/src/njs/build/njs /usr/sbin/njs \
&& echo "njs v$(njs -v)"

# https://github.com/macbre/docker-nginx-http3/issues/152
ARG CC_OPT='-g -O2 -flto=auto -ffat-lto-objects -flto=auto -ffat-lto-objects -I /usr/src/njs/quickjs'
ARG LD_OPT='-Wl,-Bsymbolic-functions -flto=auto -ffat-lto-objects -flto=auto -L /usr/src/njs/quickjs'
ARG CC_OPT='-g -O2 -flto=auto -ffat-lto-objects -flto=auto -ffat-lto-objects -I /usr/src/quickjs'
ARG LD_OPT='-Wl,-Bsymbolic-functions -flto=auto -ffat-lto-objects -flto=auto -L /usr/src/quickjs'
RUN \
echo "Building nginx ..." \
&& mkdir -p /var/run/nginx/ \
Expand Down
8 changes: 5 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## What is this?
[![Docker Image CI](https://github.com/macbre/docker-nginx-http3/actions/workflows/dockerimage.yml/badge.svg)](https://github.com/macbre/docker-nginx-http3/actions/workflows/dockerimage.yml)

Stable and up-to-date [nginx](https://nginx.org/en/CHANGES) with [QUIC + HTTP/3 support](https://nginx.org/en/docs/http/ngx_http_v3_module.html), [Google's `brotli` compression](https://github.com/google/ngx_brotli), [`njs` module](https://nginx.org/en/docs/njs/), [kTLS/sendfile support](https://delthas.fr/blog/2023/kernel-tls/) and [Grade A+ SSL config](https://ssl-config.mozilla.org/)
Stable and up-to-date [nginx](https://nginx.org/en/CHANGES) with [QUIC + HTTP/3 support](https://nginx.org/en/docs/http/ngx_http_v3_module.html), [Google's `brotli` compression](https://github.com/google/ngx_brotli), [`zstd` compression](https://github.com/tokers/zstd-nginx-module), [`njs` module](https://nginx.org/en/docs/njs/), [kTLS/sendfile support](https://delthas.fr/blog/2023/kernel-tls/) and [Grade A+ SSL config](https://ssl-config.mozilla.org/)

## How to use this image
As this project is based on the official [nginx image](https://hub.docker.com/_/nginx/) look for instructions there. In addition to the standard configuration directives, you'll be able to use the brotli module specific ones, see [here for official documentation](https://github.com/google/ngx_brotli#configuration-directives)
Expand All @@ -21,6 +21,7 @@ docker pull ghcr.io/macbre/nginx-http3:latest
* [built-in nginx modules](https://nginx.org/en/docs/)
* [`headers-more-nginx-module`](https://github.com/openresty/headers-more-nginx-module#readme) - sets and clears HTTP request and response headers
* [`ngx_brotli`](https://github.com/google/ngx_brotli#configuration-directives) - adds [brotli response compression](https://datatracker.ietf.org/doc/html/rfc7932)
* [`zstd-nginx-module`](https://github.com/tokers/zstd-nginx-module#directives) - adds [Zstandard response compression](https://datatracker.ietf.org/doc/html/rfc8878)
* [`ngx_http_geoip2_module`](https://github.com/leev/ngx_http_geoip2_module#download-maxmind-geolite2-database-optional) - creates variables with values from the maxmind geoip2 databases based on the client IP
* [`njs` module](https://nginx.org/en/docs/njs/) - a subset of the JavaScript language that allows extending nginx functionality ([GitHub repository](https://github.com/nginx/njs))

Expand Down Expand Up @@ -81,9 +82,10 @@ configure arguments:
--add-module=/usr/src/ngx_brotli
--add-module=/usr/src/headers-more-nginx-module-0.37
--add-module=/usr/src/njs/nginx
--add-module=/usr/src/zstd
--add-dynamic-module=/usr/src/ngx_http_geoip2_module
--with-cc-opt='-g -O2 -flto=auto -ffat-lto-objects -flto=auto -ffat-lto-objects'
--with-ld-opt='-Wl,-Bsymbolic-functions -flto=auto -ffat-lto-objects -flto=auto'
--with-cc-opt='-g -O2 -flto=auto -ffat-lto-objects -flto=auto -ffat-lto-objects -I /usr/src/quickjs'
--with-ld-opt='-Wl,-Bsymbolic-functions -flto=auto -ffat-lto-objects -flto=auto -L /usr/src/quickjs'
$ docker run -it macbre/nginx-http3 njs -v
0.8.7
Expand Down

0 comments on commit 3f3af29

Please sign in to comment.