Skip to content

Commit

Permalink
Use with-cc-opt for flto
Browse files Browse the repository at this point in the history
Remove `-g` from `CC_OPT`
  • Loading branch information
vincejv committed Nov 8, 2024
1 parent cc796a9 commit bcc70d6
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ ARG VERSION_OPENSSL=openssl-3.4.0
ARG NGINX_USER_UID=100
ARG NGINX_GROUP_GID=101

# NGINX Native CC Opt
ARG CC_OPT="-O3 -flto -ffat-lto-objects -fomit-frame-pointer -march=sandybridge"
ARG LD_OPT="-Wl,-Bsymbolic-functions -flto -ffat-lto-objects -flto -Wl,-z,relro -Wl,-z,now"

# https://nginx.org/en/docs/http/ngx_http_v3_module.html
ARG CONFIG="\
--build=quic-$NGINX_COMMIT \
Expand All @@ -46,7 +50,7 @@ ARG CONFIG="\
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--pid-path=/var/run/nginx/nginx.pid \
--lock-path=/var/run/nginx/nginx.lock \
--lock-path=/var/run/nginx/nginx.lock \
--http-client-body-temp-path=/var/cache/nginx/client_temp \
--http-proxy-temp-path=/var/cache/nginx/proxy_temp \
--http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp \
Expand Down Expand Up @@ -94,6 +98,7 @@ ARG CONFIG="\
--add-module=/usr/src/ngx_http_fancyindex_module \
--add-module=/usr/src/zstd-nginx-module \
--add-dynamic-module=/usr/src/ngx_http_geoip2_module \
--with-cc=clang-19 \
"

FROM debian:bookworm AS base
Expand All @@ -108,6 +113,8 @@ ARG NGINX_USER_UID
ARG NGINX_GROUP_GID
ARG CONFIG
ARG CFLAGS_OPT="-O3 -pipe -fomit-frame-pointer -march=sandybridge"
ARG CC_OPT
ARG LD_OPT

ENV VERSION_OPENSSL=openssl-3.4.0 \
SHA256_OPENSSL=e15dda82fe2fe8139dc2ac21a36d4ca01d5313c75f99f46c4e8a27709b7294bf \
Expand Down Expand Up @@ -239,6 +246,8 @@ RUN \
&& mkdir -p /var/run/nginx/ \
&& cd /usr/src/nginx-$NGINX_VERSION \
&& ./auto/configure $CONFIG \
--with-cc-opt="$CC_OPT" \
--with-ld-opt="$LD_OPT" \
&& make -j"$(getconf _NPROCESSORS_ONLN)"

RUN \
Expand Down

0 comments on commit bcc70d6

Please sign in to comment.