1- FROM nginx:1.27.4 as lua-builder
1+ FROM nginx:1.27.4 AS lua-builder
22
33RUN apt-get update && apt-get install -y \
4- build-essential zlib1g-dev libssl-dev git wget ca-certificates libreadline-dev \
4+ build-essential \
5+ pkg-config \
56 libpcre2-dev \
7+ zlib1g-dev \
8+ libssl-dev \
9+ libreadline-dev \
10+ git \
11+ wget \
12+ ca-certificates \
613 && rm -rf /var/lib/apt/lists/*
714
815WORKDIR /usr/src
@@ -12,24 +19,28 @@ WORKDIR /usr/src/luajit2
1219RUN make -j"$(nproc)" && make install
1320
1421ENV PATH="/usr/local/bin:${PATH}"
15- ENV LD_LIBRARY_PATH="/usr/local/lib:${ LD_LIBRARY_PATH}"
22+ ENV LD_LIBRARY_PATH="/usr/local/lib${LD_LIBRARY_PATH:+:$ LD_LIBRARY_PATH}"
1623
1724WORKDIR /usr/src
18- RUN git clone --branch v0.3.2 https://github.com/simpl/ngx_devel_kit.git
19- RUN git clone --branch v0.10.25 https://github.com/openresty/lua-nginx-module.git
25+
26+ ARG NDK_V=v0.3.3
27+ ARG LUA_NGX_V=v0.10.27
28+ RUN git clone --branch ${NDK_V} --single-branch https://github.com/simpl/ngx_devel_kit.git
29+ RUN git clone --branch ${LUA_NGX_V} --single-branch https://github.com/openresty/lua-nginx-module.git
2030
2131ARG NGINX_V=1.27.4
2232RUN wget http://nginx.org/download/nginx-${NGINX_V}.tar.gz \
2333 && tar zxf nginx-${NGINX_V}.tar.gz
2434
2535WORKDIR /usr/src/nginx-${NGINX_V}
36+
2637ENV LUAJIT_LIB=/usr/local/lib
2738ENV LUAJIT_INC=/usr/local/include/luajit-2.1
2839
2940RUN ./configure --with-compat \
3041 --add-dynamic-module=../ngx_devel_kit \
3142 --add-dynamic-module=../lua-nginx-module \
3243 --with-ld-opt="-Wl,-rpath,/usr/local/lib" \
33- || { echo '--- CONFIG.LOG ---'; cat objs/autoconf.err 2>/dev/null || true; exit 1; }
44+ || { echo '--- autoconf.err ---'; cat objs/autoconf.err 2>/dev/null || true; exit 1; }
3445
35- RUN make modules -j"$(nproc)"
46+ RUN make modules -j"$(nproc)" V=1 || { echo '--- make failed ---'; exit 1; }
0 commit comments