Skip to content

Commit e91a51c

Browse files
committed
Update LUA new-tag
1 parent 0dc891c commit e91a51c

File tree

1 file changed

+20
-40
lines changed

1 file changed

+20
-40
lines changed

build/Dockerfile.luam

Lines changed: 20 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,46 @@
1-
# -------- builder: lua/ndk dynamic modules for nginx 1.27.4 (PCRE2) --------
2-
FROM nginx:1.27.4 AS lua-builder
1+
# --- minimal builder for ndk + lua modules (nginx 1.27.4, PCRE2) ---
2+
FROM nginx:1.27.4 AS build
33

4-
# Мінімум потрібного + інструменти для саніті-чеків (objdump/readelf)
54
RUN apt-get update && apt-get install -y --no-install-recommends \
65
build-essential pkg-config \
7-
libpcre2-dev zlib1g-dev libssl-dev libreadline-dev \
8-
git wget ca-certificates binutils \
6+
libpcre2-dev zlib1g-dev libssl-dev \
7+
git wget ca-certificates \
98
&& rm -rf /var/lib/apt/lists/*
109

1110
WORKDIR /usr/src
1211

13-
# ---- LuaJIT (runtime буде підсовуватись окремо/системний) ----
12+
# LuaJIT (потрібен для збірки lua-модуля)
1413
RUN git clone --branch v2.1-agentzh --single-branch https://github.com/openresty/luajit2.git
1514
WORKDIR /usr/src/luajit2
1615
RUN make -j"$(nproc)" && make install
1716

18-
ENV PATH="/usr/local/bin:${PATH}"
19-
ENV LD_LIBRARY_PATH="/usr/local/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
17+
ENV LUAJIT_LIB=/usr/local/lib
18+
ENV LUAJIT_INC=/usr/local/include/luajit-2.1
2019

21-
# ---- NDK + lua-nginx-module (сумісні з 1.27.x) ----
22-
WORKDIR /usr/src
20+
# NDK + lua-nginx-module (версії сумісні з 1.27.x)
2321
ARG NDK_V=v0.3.3
2422
ARG LUA_NGX_V=v0.10.27
23+
WORKDIR /usr/src
2524
RUN git clone --branch "${NDK_V}" --single-branch https://github.com/simpl/ngx_devel_kit.git
2625
RUN git clone --branch "${LUA_NGX_V}" --single-branch https://github.com/openresty/lua-nginx-module.git
2726

28-
# ---- NGINX sources (точно 1.27.4) ----
27+
# NGINX sources рівно 1.27.4
2928
ARG NGINX_V=1.27.4
3029
RUN wget -O "nginx-${NGINX_V}.tar.gz" "http://nginx.org/download/nginx-${NGINX_V}.tar.gz" \
3130
&& tar zxf "nginx-${NGINX_V}.tar.gz"
3231

3332
WORKDIR /usr/src/nginx-${NGINX_V}
3433

35-
# LuaJIT include/lib for lua-nginx-module
36-
ENV LUAJIT_LIB=/usr/local/lib
37-
ENV LUAJIT_INC=/usr/local/include/luajit-2.1
38-
39-
# ВАЖЛИВО: НЕ додаємо --with-pcre=..., авто-детект підійме PCRE2 з libpcre2-dev
34+
# Збірка динамічних модулів (без --with-pcre=*, авто PCRE2)
4035
RUN ./configure --with-compat \
4136
--add-dynamic-module=../ngx_devel_kit \
4237
--add-dynamic-module=../lua-nginx-module \
43-
--with-ld-opt="-Wl,-rpath,/usr/local/lib" \
44-
|| { echo '--- autoconf.err ---'; cat objs/autoconf.err 2>/dev/null || true; exit 1; }
45-
46-
# Переконаймося, що NGINX побачив PCRE2
47-
RUN grep -q '^[[:space:]]*#define[[:space:]]\+NGX_PCRE2[[:space:]]\+1' objs/ngx_auto_config.h \
48-
|| { echo 'ERROR: NGX_PCRE2 not defined. PCRE2 was not detected.'; exit 1; }
49-
50-
# Збираємо модулі з докладним логом
51-
RUN make modules -j"$(nproc)" V=1
52-
53-
# Саніті-чек: у готовому .so НЕ повинно бути символів pcre_*
54-
RUN objdump -T objs/ngx_http_lua_module.so | grep -i '\bpcre_' && { echo 'ERROR: lua module links to PCRE1 symbols'; exit 1; } || true
55-
RUN readelf -d objs/ngx_http_lua_module.so | grep -i 'NEEDED.*libpcre' && { echo 'ERROR: lua module NEEDS libpcre (PCRE1)'; exit 1; } || true
56-
57-
# Викладаємо артефакти у зрозуміле місце
58-
RUN mkdir -p /artifacts
59-
RUN install -m 0644 objs/ndk_http_module.so /artifacts/ndk_http_module.so
60-
RUN install -m 0644 objs/ngx_http_lua_module.so /artifacts/ngx_http_lua_module.so
61-
# додатково: покладемо runtime-лібу LuaJIT (якщо хочеш самодостатній артефакт)
62-
RUN install -m 0644 /usr/local/lib/libluajit-5.1.so.2 /artifacts/libluajit-5.1.so.2 || true
63-
64-
# Маніфест + SHA256 — корисно для перевірок у “основному” образі/CI
65-
RUN sh -c 'cat > /artifacts/manifest.yaml <<EOF\nmodule_set:\n nginx_version: "'"${NGINX_V}"'"\n ndk_version: "'"${NDK_V}"'"\n lua_module_version: "'"${LUA_NGX_V}"'"\n pcre2: true\n built_with_compat: true\n luajit: "2.1 (openresty/luajit2)"\nartifacts:\n - ndk_http_module.so\n - ngx_http_lua_module.so\n - libluajit-5.1.so.2\nEOF'
66-
RUN sh -c 'cd /artifacts && sha256sum * > SHA256SUMS'
38+
--with-ld-opt="-Wl,-rpath,/usr/local/lib"
39+
RUN make modules -j"$(nproc)"
40+
41+
# --- stage із артефактами, щоб легко вивантажити їх локально ---
42+
FROM scratch AS out
43+
COPY --from=build /usr/src/nginx-1.27.4/objs/ndk_http_module.so /artifacts/ndk_http_module.so
44+
COPY --from=build /usr/src/nginx-1.27.4/objs/ngx_http_lua_module.so /artifacts/ngx_http_lua_module.so
45+
# якщо хочеш самодостатній рантайм без apt:
46+
COPY --from=build /usr/local/lib/libluajit-5.1.so.2 /artifacts/libluajit-5.1.so.2

0 commit comments

Comments
 (0)