Skip to content

Commit

Permalink
add lua, don't build static
Browse files Browse the repository at this point in the history
Signed-off-by: Zoey <[email protected]>
  • Loading branch information
Zoey2936 committed May 17, 2023
1 parent 981cd30 commit 74d1bfa
Showing 1 changed file with 29 additions and 14 deletions.
43 changes: 29 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,34 +1,43 @@
FROM alpine:3.18.0 as build
ARG BUILD

ARG LUAJIT_INC=/usr/include/luajit-2.1
ARG LUAJIT_LIB=/usr/lib

# Requirements
RUN apk add --no-cache ca-certificates build-base patch cmake git mercurial perl \
libatomic_ops-dev libatomic_ops-static zlib-dev zlib-static pcre-dev linux-headers && \
libatomic_ops-dev zlib-dev luajit-dev pcre-dev linux-headers && \
mkdir /src && \
# Openssl
git clone --recursive https://github.com/quictls/openssl /src/openssl && \
cd /src/openssl && \
/src/openssl/Configure && \
make -j "$(nproc)" && \
make -j "$(nproc)"
# Nginx
hg clone https://hg.nginx.org/nginx-quic -r "quic" /src/nginx && \
RUN hg clone https://hg.nginx.org/nginx-quic -r "quic" /src/nginx && \
wget https://raw.githubusercontent.com/nginx-modules/ngx_http_tls_dyn_size/master/nginx__dynamic_tls_records_1.17.7%2B.patch -O /src/nginx/1.patch && \
wget https://github.com/angristan/nginx-autoinstall/raw/master/patches/nginx_hpack_push_with_http3.patch -O /src/nginx/2.patch && \
wget https://raw.githubusercontent.com/openresty/openresty/master/patches/nginx-1.23.0-resolver_conf_parsing.patch -O /src/nginx/3.patch && \
sed -i "s|nginx/|nginx-proxy-manager/|g" /src/nginx/src/core/nginx.h && \
sed -i "s|Server: nginx|Server: nginx-proxy-manager|g" /src/nginx/src/http/ngx_http_header_filter_module.c && \
sed -i "s|<hr><center>nginx</center>|<hr><center>nginx-proxy-manager</center>|g" /src/nginx/src/http/ngx_http_special_response.c && \
cd /src/nginx && \
patch -p1 </src/nginx/1.patch && \
patch -p1 </src/nginx/2.patch && \
patch -p1 </src/nginx/3.patch && \
rm /src/nginx/*.patch && \
# modules
# hg clone http://hg.nginx.org/njs /src/njs && \
# git clone --recursive https://github.com/itoffshore/nginx-upstream-fair /src/nginx-upstream-fair && \
# git clone --recursive https://github.com/kyprizel/testcookie-nginx-module /src/testcookie-nginx-module && \
# git clone --recursive https://github.com/dvershinin/ngx_http_js_challenge_module /src/ngx_http_js_challenge_module && \
git clone --recursive https://github.com/google/ngx_brotli /src/ngx_brotli && \
git clone --recursive https://github.com/aperezdc/ngx-fancyindex /src/ngx-fancyindex && \
git clone --recursive https://github.com/GetPageSpeed/ngx_security_headers /src/ngx_security_headers && \
git clone --recursive https://github.com/google/ngx_brotli /src/ngx_brotli && \
# hg clone http://hg.nginx.org/njs /src/njs && \
git clone --recursive https://github.com/vision5/ngx_devel_kit /src/ngx_devel_kit && \
git clone --recursive https://github.com/openresty/lua-nginx-module /src/lua-nginx-module && \
git clone --recursive https://github.com/openresty/lua-resty-core /src/lua-resty-core && \
git clone --recursive https://github.com/openresty/lua-resty-lrucache /src/lua-resty-lrucache && \
# Configure
cd /src/nginx && \
/src/nginx/auto/configure \
Expand All @@ -42,39 +51,45 @@ RUN apk add --no-cache ca-certificates build-base patch cmake git mercurial perl
--without-poll_module \
--without-select_module \
--with-openssl="/src/openssl" \
--with-ld-opt="-L/src/openssl/build/lib -static" \
--with-ld-opt="-L/src/openssl/build/lib" \
--with-cc-opt="-I/src/openssl/build/include" \
# --with-mail \
# --with-mail_ssl_module \
--with-stream \
--with-stream_ssl_module \
--with-stream_quic_module \
--with-stream_realip_module \
--with-stream_ssl_preread_module \
--with-http_ssl_module \
# --with-stream_ssl_module \
# --with-stream_quic_module \
# --with-stream_realip_module \
# --with-stream_ssl_preread_module \
--with-http_v2_module \
--with-http_v2_hpack_enc \
--with-http_v3_module \
--with-http_ssl_module \
--with-http_realip_module \
--with-http_gunzip_module \
--with-http_addition_module \
--with-http_gzip_static_module \
--with-http_auth_request_module \
--add-module=/src/ngx_brotli \
--add-module=/src/ngx-fancyindex \
--add-module=/src/ngx_security_headers && \
--add-module=/src/ngx_security_headers \
# --add-module=/src/njs/nginx \
--add-module=/src/ngx_devel_kit \
--add-module=/src/lua-nginx-module && \
# --add-module=/src/nginx-upstream-fair \
# --add-module=/src/testcookie-nginx-module \
# --add-module=/src/ngx_http_js_challenge_module \
# Build & Install
make -j "$(nproc)" && \
make -j "$(nproc)" install && \
strip -s /usr/local/nginx/sbin/nginx
strip -s /usr/local/nginx/sbin/nginx && \
cd /src/lua-resty-core && \
make install PREFIX=/usr/local/nginx && \
cd /src/lua-resty-lrucache && \
make install PREFIX=/usr/local/nginx

FROM python:3.11.3-alpine3.18
COPY --from=build /usr/local/nginx /usr/local/nginx
RUN apk add --no-cache ca-certificates tzdata && \
RUN apk add --no-cache ca-certificates tzdata zlib luajit pcre && \
ln -s /usr/local/nginx/sbin/nginx /usr/local/bin/nginx
ENTRYPOINT ["nginx"]
CMD ["-g", "daemon off;"]

0 comments on commit 74d1bfa

Please sign in to comment.