Skip to content

Commit 675d19d

Browse files
committed
Add restyrepo flavor for building fully from GitHub
Signed-off-by: Evan Wies <evan@neomantra.net>
1 parent 787dc4f commit 675d19d

2 files changed

Lines changed: 240 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
`docker-openresty` Changelog
22
============================
33

4+
## 1.29.2.3-5 (unreleased)
5+
6+
* Add `restyrepo/Dockerfile` for building OpenResty fully from GitHub, including the source distribution package.
7+
48
## 1.29.2.3-4 (2026-04-22)
59

610
* Upgrade OpenSSL to 3.5.6

restyrepo/Dockerfile

Lines changed: 236 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,236 @@
1+
# Dockerfile - OpenResty Source Branch build against Debian Trixie
2+
# https://github.com/openresty/docker-openresty
3+
4+
ARG RESTY_IMAGE_BASE="debian"
5+
ARG RESTY_IMAGE_TAG="trixie-slim"
6+
7+
FROM ${RESTY_IMAGE_BASE}:${RESTY_IMAGE_TAG}
8+
9+
LABEL maintainer="Evan Wies <evan@neomantra.net>"
10+
11+
# Docker Build Arguments
12+
ARG RESTY_IMAGE_BASE="debian"
13+
ARG RESTY_IMAGE_TAG="trixie-slim"
14+
ARG RESTY_VERSION="master"
15+
ARG RESTY_SOURCE_REPO="https://github.com/openresty/openresty.git"
16+
ARG RESTY_LUAROCKS_VERSION="3.13.0"
17+
18+
# https://github.com/openresty/openresty-packaging/blob/master/deb/openresty-openssl3/debian/rules
19+
ARG RESTY_OPENSSL_VERSION="3.5.6"
20+
ARG RESTY_OPENSSL_PATCH_VERSION="3.5.5"
21+
ARG RESTY_OPENSSL_URL_BASE="https://github.com/openssl/openssl/releases/download/openssl-${RESTY_OPENSSL_VERSION}"
22+
# LEGACY: "https://www.openssl.org/source/old/1.1.1"
23+
ARG RESTY_OPENSSL_BUILD_OPTIONS="enable-camellia enable-seed enable-rfc3779 enable-cms enable-md2 enable-rc5 \
24+
enable-weak-ssl-ciphers enable-ssl3 enable-ssl3-method enable-md2 enable-ktls enable-fips \
25+
"
26+
27+
# https://github.com/openresty/openresty-packaging/blob/master/deb/openresty-pcre2/debian/rules
28+
ARG RESTY_PCRE_VERSION="10.47"
29+
ARG RESTY_PCRE_SHA256="c08ae2388ef333e8403e670ad70c0a11f1eed021fd88308d7e02f596fcd9dc16"
30+
ARG RESTY_PCRE_BUILD_OPTIONS="--enable-jit --enable-pcre2grep-jit --disable-bsr-anycrlf --disable-coverage --disable-ebcdic --disable-fuzz-support \
31+
--disable-jit-sealloc --disable-never-backslash-C --enable-newline-is-lf --enable-pcre2-8 --enable-pcre2-16 --enable-pcre2-32 \
32+
--enable-pcre2grep-callout --enable-pcre2grep-callout-fork --disable-pcre2grep-libbz2 --disable-pcre2grep-libz --disable-pcre2test-libedit \
33+
--enable-percent-zt --disable-rebuild-chartables --enable-shared --disable-static --disable-silent-rules --enable-unicode --disable-valgrind \
34+
"
35+
36+
ARG RESTY_J="1"
37+
38+
# https://github.com/openresty/openresty-packaging/blob/master/deb/openresty/debian/rules
39+
ARG RESTY_CONFIG_OPTIONS="\
40+
--with-compat \
41+
--without-http_rds_json_module \
42+
--without-http_rds_csv_module \
43+
--without-lua_rds_parser \
44+
--without-mail_pop3_module \
45+
--without-mail_imap_module \
46+
--without-mail_smtp_module \
47+
--with-http_addition_module \
48+
--with-http_auth_request_module \
49+
--with-http_dav_module \
50+
--with-http_flv_module \
51+
--with-http_geoip_module=dynamic \
52+
--with-http_gunzip_module \
53+
--with-http_gzip_static_module \
54+
--with-http_image_filter_module=dynamic \
55+
--with-http_mp4_module \
56+
--with-http_random_index_module \
57+
--with-http_realip_module \
58+
--with-http_secure_link_module \
59+
--with-http_slice_module \
60+
--with-http_ssl_module \
61+
--with-http_stub_status_module \
62+
--with-http_sub_module \
63+
--with-http_v2_module \
64+
--with-http_v3_module \
65+
--with-http_xslt_module=dynamic \
66+
--with-ipv6 \
67+
--with-mail \
68+
--with-mail_ssl_module \
69+
--with-md5-asm \
70+
--with-sha1-asm \
71+
--with-stream \
72+
--with-stream_ssl_module \
73+
--with-stream_ssl_preread_module \
74+
--with-threads \
75+
"
76+
ARG RESTY_CONFIG_OPTIONS_MORE=""
77+
ARG RESTY_LUAJIT_OPTIONS="--with-luajit-xcflags='-DLUAJIT_NUMMODE=2 -DLUAJIT_ENABLE_LUA52COMPAT'"
78+
ARG RESTY_PCRE_OPTIONS="--with-pcre-jit"
79+
80+
ARG RESTY_ADD_PACKAGE_BUILDDEPS=""
81+
ARG RESTY_ADD_PACKAGE_RUNDEPS=""
82+
ARG RESTY_EVAL_PRE_CONFIGURE=""
83+
ARG RESTY_EVAL_POST_DOWNLOAD_PRE_CONFIGURE=""
84+
ARG RESTY_EVAL_PRE_MAKE=""
85+
ARG RESTY_EVAL_POST_MAKE=""
86+
87+
# These are not intended to be user-specified
88+
ARG _RESTY_CONFIG_DEPS="--with-pcre \
89+
--with-cc-opt='-DNGX_LUA_ABORT_AT_PANIC -I/usr/local/openresty/pcre2/include -I/usr/local/openresty/openssl3/include' \
90+
--with-ld-opt='-L/usr/local/openresty/pcre2/lib -L/usr/local/openresty/openssl3/lib -Wl,-rpath,/usr/local/openresty/pcre2/lib:/usr/local/openresty/openssl3/lib' \
91+
"
92+
93+
LABEL resty_image_base="${RESTY_IMAGE_BASE}"
94+
LABEL resty_image_tag="${RESTY_IMAGE_TAG}"
95+
LABEL resty_version="${RESTY_VERSION}"
96+
LABEL resty_luarocks_version="${RESTY_LUAROCKS_VERSION}"
97+
LABEL resty_openssl_version="${RESTY_OPENSSL_VERSION}"
98+
LABEL resty_openssl_patch_version="${RESTY_OPENSSL_PATCH_VERSION}"
99+
LABEL resty_openssl_url_base="${RESTY_OPENSSL_URL_BASE}"
100+
LABEL resty_openssl_build_options="${RESTY_OPENSSL_BUILD_OPTIONS}"
101+
LABEL resty_pcre_version="${RESTY_PCRE_VERSION}"
102+
LABEL resty_pcre_build_options="${RESTY_PCRE_BUILD_OPTIONS}"
103+
LABEL resty_pcre_sha256="${RESTY_PCRE_SHA256}"
104+
LABEL resty_config_options="${RESTY_CONFIG_OPTIONS}"
105+
LABEL resty_config_options_more="${RESTY_CONFIG_OPTIONS_MORE}"
106+
LABEL resty_config_deps="${_RESTY_CONFIG_DEPS}"
107+
LABEL resty_add_package_builddeps="${RESTY_ADD_PACKAGE_BUILDDEPS}"
108+
LABEL resty_add_package_rundeps="${RESTY_ADD_PACKAGE_RUNDEPS}"
109+
LABEL resty_eval_pre_configure="${RESTY_EVAL_PRE_CONFIGURE}"
110+
LABEL resty_eval_post_download_pre_configure="${RESTY_EVAL_POST_DOWNLOAD_PRE_CONFIGURE}"
111+
LABEL resty_eval_pre_make="${RESTY_EVAL_PRE_MAKE}"
112+
LABEL resty_eval_post_make="${RESTY_EVAL_POST_MAKE}"
113+
LABEL resty_luajit_options="${RESTY_LUAJIT_OPTIONS}"
114+
LABEL resty_pcre_options="${RESTY_PCRE_OPTIONS}"
115+
116+
117+
118+
RUN DEBIAN_FRONTEND=noninteractive apt-get update \
119+
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
120+
ca-certificates \
121+
curl \
122+
dos2unix \
123+
git \
124+
make \
125+
mercurial \
126+
patch \
127+
perl \
128+
unzip \
129+
wget \
130+
&& cd /tmp \
131+
&& git clone --depth 1 "${RESTY_SOURCE_REPO}" openresty_src \
132+
&& cd openresty_src \
133+
&& git checkout master \
134+
&& make \
135+
&& mv openresty-*.tar.gz "/tmp/openresty-${RESTY_VERSION}.tar.gz" \
136+
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
137+
build-essential \
138+
gettext-base \
139+
libgd-dev \
140+
libgeoip-dev \
141+
libncurses5-dev \
142+
libperl-dev \
143+
libreadline-dev \
144+
libxslt1-dev \
145+
zlib1g-dev \
146+
${RESTY_ADD_PACKAGE_BUILDDEPS} \
147+
${RESTY_ADD_PACKAGE_RUNDEPS} \
148+
&& cd /tmp \
149+
&& if [ -n "${RESTY_EVAL_PRE_CONFIGURE}" ]; then eval $(echo ${RESTY_EVAL_PRE_CONFIGURE}); fi \
150+
&& curl -fSL "${RESTY_OPENSSL_URL_BASE}/openssl-${RESTY_OPENSSL_VERSION}.tar.gz" -o openssl-${RESTY_OPENSSL_VERSION}.tar.gz \
151+
&& tar xzf openssl-${RESTY_OPENSSL_VERSION}.tar.gz \
152+
&& cd openssl-${RESTY_OPENSSL_VERSION} \
153+
&& if [ $(echo ${RESTY_OPENSSL_VERSION} | cut -c 1-2) = "3." ] ; then \
154+
echo 'patching OpenSSL 3.x for OpenResty' \
155+
&& curl -s https://raw.githubusercontent.com/openresty/openresty/master/patches/openssl-${RESTY_OPENSSL_PATCH_VERSION}-sess_set_get_cb_yield.patch | patch -p1 ; \
156+
fi \
157+
&& if [ $(echo ${RESTY_OPENSSL_VERSION} | cut -c 1-5) = "1.1.1" ] ; then \
158+
echo 'patching OpenSSL 1.1.1 for OpenResty' \
159+
&& curl -s https://raw.githubusercontent.com/openresty/openresty/master/patches/openssl-${RESTY_OPENSSL_PATCH_VERSION}-sess_set_get_cb_yield.patch | patch -p1 ; \
160+
fi \
161+
&& if [ $(echo ${RESTY_OPENSSL_VERSION} | cut -c 1-5) = "1.1.0" ] ; then \
162+
echo 'patching OpenSSL 1.1.0 for OpenResty' \
163+
&& curl -s https://raw.githubusercontent.com/openresty/openresty/ed328977028c3ec3033bc25873ee360056e247cd/patches/openssl-1.1.0j-parallel_build_fix.patch | patch -p1 \
164+
&& curl -s https://raw.githubusercontent.com/openresty/openresty/master/patches/openssl-${RESTY_OPENSSL_PATCH_VERSION}-sess_set_get_cb_yield.patch | patch -p1 ; \
165+
fi \
166+
&& ./config \
167+
shared zlib -g \
168+
--prefix=/usr/local/openresty/openssl3 \
169+
--libdir=lib \
170+
-Wl,-rpath,/usr/local/openresty/openssl3/lib \
171+
${RESTY_OPENSSL_BUILD_OPTIONS} \
172+
&& make -j${RESTY_J} \
173+
&& make -j${RESTY_J} install_sw \
174+
&& cd /tmp \
175+
&& curl -fSL "https://github.com/PCRE2Project/pcre2/releases/download/pcre2-${RESTY_PCRE_VERSION}/pcre2-${RESTY_PCRE_VERSION}.tar.gz" -o pcre2-${RESTY_PCRE_VERSION}.tar.gz \
176+
&& echo "${RESTY_PCRE_SHA256} pcre2-${RESTY_PCRE_VERSION}.tar.gz" | shasum -a 256 --check \
177+
&& tar xzf pcre2-${RESTY_PCRE_VERSION}.tar.gz \
178+
&& cd /tmp/pcre2-${RESTY_PCRE_VERSION} \
179+
&& CFLAGS="-g -O3" ./configure \
180+
--prefix=/usr/local/openresty/pcre2 \
181+
--libdir=/usr/local/openresty/pcre2/lib \
182+
${RESTY_PCRE_BUILD_OPTIONS} \
183+
&& CFLAGS="-g -O3" make -j${RESTY_J} \
184+
&& CFLAGS="-g -O3" make -j${RESTY_J} install \
185+
&& cd /tmp \
186+
&& tar xzf "openresty-${RESTY_VERSION}.tar.gz" \
187+
&& mv openresty-*/ "openresty-${RESTY_VERSION}" \
188+
&& cd /tmp/openresty-${RESTY_VERSION} \
189+
&& if [ -n "${RESTY_EVAL_POST_DOWNLOAD_PRE_CONFIGURE}" ]; then eval $(echo ${RESTY_EVAL_POST_DOWNLOAD_PRE_CONFIGURE}); fi \
190+
&& eval ./configure -j${RESTY_J} ${_RESTY_CONFIG_DEPS} ${RESTY_CONFIG_OPTIONS} ${RESTY_CONFIG_OPTIONS_MORE} ${RESTY_LUAJIT_OPTIONS} ${RESTY_PCRE_OPTIONS} \
191+
&& if [ -n "${RESTY_EVAL_PRE_MAKE}" ]; then eval $(echo ${RESTY_EVAL_PRE_MAKE}); fi \
192+
&& make -j${RESTY_J} \
193+
&& make -j${RESTY_J} install \
194+
&& cd /tmp \
195+
&& rm -rf \
196+
openssl-${RESTY_OPENSSL_VERSION}.tar.gz openssl-${RESTY_OPENSSL_VERSION} \
197+
pcre2-${RESTY_PCRE_VERSION}.tar.gz pcre2-${RESTY_PCRE_VERSION} \
198+
openresty-${RESTY_VERSION}.tar.gz openresty-${RESTY_VERSION} openresty_src \
199+
&& curl -fSL https://luarocks.github.io/luarocks/releases/luarocks-${RESTY_LUAROCKS_VERSION}.tar.gz -o luarocks-${RESTY_LUAROCKS_VERSION}.tar.gz \
200+
&& tar xzf luarocks-${RESTY_LUAROCKS_VERSION}.tar.gz \
201+
&& cd luarocks-${RESTY_LUAROCKS_VERSION} \
202+
&& ./configure \
203+
--prefix=/usr/local/openresty/luajit \
204+
--with-lua=/usr/local/openresty/luajit \
205+
--with-lua-include=/usr/local/openresty/luajit/include/luajit-2.1 \
206+
&& make build \
207+
&& make install \
208+
&& cd /tmp \
209+
&& if [ -n "${RESTY_EVAL_POST_MAKE}" ]; then eval $(echo ${RESTY_EVAL_POST_MAKE}); fi \
210+
&& rm -rf luarocks-${RESTY_LUAROCKS_VERSION} luarocks-${RESTY_LUAROCKS_VERSION}.tar.gz \
211+
&& if [ -n "${RESTY_ADD_PACKAGE_BUILDDEPS}" ]; then DEBIAN_FRONTEND=noninteractive apt-get remove -y --purge ${RESTY_ADD_PACKAGE_BUILDDEPS} ; fi \
212+
&& DEBIAN_FRONTEND=noninteractive apt-get autoremove -y \
213+
&& mkdir -p /var/run/openresty \
214+
&& ln -sf /dev/stdout /usr/local/openresty/nginx/logs/access.log \
215+
&& ln -sf /dev/stderr /usr/local/openresty/nginx/logs/error.log
216+
217+
# Add additional binaries into PATH for convenience
218+
ENV PATH=$PATH:/usr/local/openresty/luajit/bin:/usr/local/openresty/nginx/sbin:/usr/local/openresty/bin
219+
220+
# Add LuaRocks paths
221+
# If OpenResty changes, these may need updating:
222+
# /usr/local/openresty/bin/resty -e 'print(package.path)'
223+
# /usr/local/openresty/bin/resty -e 'print(package.cpath)'
224+
ENV LUA_PATH="/usr/local/openresty/site/lualib/?.ljbc;/usr/local/openresty/site/lualib/?/init.ljbc;/usr/local/openresty/lualib/?.ljbc;/usr/local/openresty/lualib/?/init.ljbc;/usr/local/openresty/site/lualib/?.lua;/usr/local/openresty/site/lualib/?/init.lua;/usr/local/openresty/lualib/?.lua;/usr/local/openresty/lualib/?/init.lua;./?.lua;/usr/local/openresty/luajit/share/luajit-2.1/?.lua;/usr/local/share/lua/5.1/?.lua;/usr/local/share/lua/5.1/?/init.lua;/usr/local/openresty/luajit/share/lua/5.1/?.lua;/usr/local/openresty/luajit/share/lua/5.1/?/init.lua"
225+
226+
ENV LUA_CPATH="/usr/local/openresty/site/lualib/?.so;/usr/local/openresty/lualib/?.so;./?.so;/usr/local/lib/lua/5.1/?.so;/usr/local/openresty/luajit/lib/lua/5.1/?.so;/usr/local/lib/lua/5.1/loadall.so;/usr/local/openresty/luajit/lib/lua/5.1/?.so"
227+
228+
# Copy nginx configuration files
229+
COPY nginx.conf /usr/local/openresty/nginx/conf/nginx.conf
230+
COPY nginx.vh.default.conf /etc/nginx/conf.d/default.conf
231+
232+
CMD ["/usr/local/openresty/bin/openresty", "-g", "daemon off;"]
233+
234+
# Use SIGQUIT instead of default SIGTERM to cleanly drain requests
235+
# See https://github.com/openresty/docker-openresty/blob/master/README.md#tips--pitfalls
236+
STOPSIGNAL SIGQUIT

0 commit comments

Comments
 (0)