Skip to content

Commit 0dc891c

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

File tree

1 file changed

+36
-16
lines changed

1 file changed

+36
-16
lines changed

build/Dockerfile.luam

Lines changed: 36 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,66 @@
1+
# -------- builder: lua/ndk dynamic modules for nginx 1.27.4 (PCRE2) --------
12
FROM nginx:1.27.4 AS lua-builder
23

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

1511
WORKDIR /usr/src
1612

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

2118
ENV PATH="/usr/local/bin:${PATH}"
2219
ENV LD_LIBRARY_PATH="/usr/local/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
2320

21+
# ---- NDK + lua-nginx-module (сумісні з 1.27.x) ----
2422
WORKDIR /usr/src
25-
2623
ARG NDK_V=v0.3.3
2724
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
25+
RUN git clone --branch "${NDK_V}" --single-branch https://github.com/simpl/ngx_devel_kit.git
26+
RUN git clone --branch "${LUA_NGX_V}" --single-branch https://github.com/openresty/lua-nginx-module.git
3027

28+
# ---- NGINX sources (точно 1.27.4) ----
3129
ARG NGINX_V=1.27.4
32-
RUN wget http://nginx.org/download/nginx-${NGINX_V}.tar.gz \
33-
&& tar zxf nginx-${NGINX_V}.tar.gz
30+
RUN wget -O "nginx-${NGINX_V}.tar.gz" "http://nginx.org/download/nginx-${NGINX_V}.tar.gz" \
31+
&& tar zxf "nginx-${NGINX_V}.tar.gz"
3432

3533
WORKDIR /usr/src/nginx-${NGINX_V}
3634

35+
# LuaJIT include/lib for lua-nginx-module
3736
ENV LUAJIT_LIB=/usr/local/lib
3837
ENV LUAJIT_INC=/usr/local/include/luajit-2.1
3938

39+
# ВАЖЛИВО: НЕ додаємо --with-pcre=..., авто-детект підійме PCRE2 з libpcre2-dev
4040
RUN ./configure --with-compat \
4141
--add-dynamic-module=../ngx_devel_kit \
4242
--add-dynamic-module=../lua-nginx-module \
4343
--with-ld-opt="-Wl,-rpath,/usr/local/lib" \
4444
|| { echo '--- autoconf.err ---'; cat objs/autoconf.err 2>/dev/null || true; exit 1; }
4545

46-
RUN make modules -j"$(nproc)" V=1 || { echo '--- make failed ---'; exit 1; }
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'

0 commit comments

Comments
 (0)