Nginx的静态构建



我正在准备一个Docker镜像,它打算使用Nginx 的静态构建

RUN set -ex 
&& wget -qO- github.com/nginx/nginx/archive/"$NGINX_HASH".tar.gz | tar zx --strip-components=1 
&& ./auto/configure --without-http_rewrite_module --without-http_gzip_module 
&& make CFLAGS="-O2 -s" LDFLAGS="-static" -j$(nproc) 
&& ldd ./objs/nginx

不幸的是,即使有标志-static,它似乎也与musl 有关

ldd ./objs/nginx
/lib/ld-musl-x86_64.so.1 (0x7fcce5ebe000)
libc.musl-x86_64.so.1 => /lib/ld-musl-x86_64.so.1 (0x7fcce5ebe000)

我需要做什么才能静态链接?

使用解决

RUN ./auto/configure --without-http_rewrite_module --without-http_gzip_module --with-cc-opt="-O2" --with-ld-opt="-s -static"

最新更新