1- # --- minimal builder for ndk + lua modules (nginx 1.27.4, PCRE2) ---
21FROM nginx:1.27.4 AS build
32
43RUN apt-get update && apt-get install -y --no-install-recommends \
@@ -9,38 +8,32 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
98
109WORKDIR /usr/src
1110
12- # LuaJIT (потрібен для збірки lua-модуля)
1311RUN git clone --branch v2.1-agentzh --single-branch https://github.com/openresty/luajit2.git
1412WORKDIR /usr/src/luajit2
1513RUN make -j"$(nproc)" && make install
1614
1715ENV LUAJIT_LIB=/usr/local/lib
1816ENV LUAJIT_INC=/usr/local/include/luajit-2.1
1917
20- # NDK + lua-nginx-module (версії сумісні з 1.27.x)
2118ARG NDK_V=v0.3.3
2219ARG LUA_NGX_V=v0.10.27
2320WORKDIR /usr/src
2421RUN git clone --branch "${NDK_V}" --single-branch https://github.com/simpl/ngx_devel_kit.git
2522RUN git clone --branch "${LUA_NGX_V}" --single-branch https://github.com/openresty/lua-nginx-module.git
2623
27- # NGINX sources рівно 1.27.4
2824ARG NGINX_V=1.27.4
2925RUN wget -O "nginx-${NGINX_V}.tar.gz" "http://nginx.org/download/nginx-${NGINX_V}.tar.gz" \
3026 && tar zxf "nginx-${NGINX_V}.tar.gz"
3127
3228WORKDIR /usr/src/nginx-${NGINX_V}
3329
34- # Збірка динамічних модулів (без --with-pcre=*, авто PCRE2)
3530RUN ./configure --with-compat \
3631 --add-dynamic-module=../ngx_devel_kit \
3732 --add-dynamic-module=../lua-nginx-module \
3833 --with-ld-opt="-Wl,-rpath,/usr/local/lib"
3934RUN make modules -j"$(nproc)"
4035
41- # --- stage із артефактами, щоб легко вивантажити їх локально ---
4236FROM scratch AS out
4337COPY --from=build /usr/src/nginx-1.27.4/objs/ndk_http_module.so /artifacts/ndk_http_module.so
4438COPY --from=build /usr/src/nginx-1.27.4/objs/ngx_http_lua_module.so /artifacts/ngx_http_lua_module.so
45- # якщо хочеш самодостатній рантайм без apt:
4639COPY --from=build /usr/local/lib/libluajit-5.1.so.2 /artifacts/libluajit-5.1.so.2
0 commit comments