Skip to content

Commit 5344662

Browse files
committed
refactor: remove unused build steps and files.
- Remove unnecessary build argument - Upgrade `luarocks` version to `3.11.0` - Add build steps for `ngx_brotli` - Remove `lua-suffix` from luajit configuration - Update `LUA_PATH` environment variable - Remove unused `ngx_brotli` build steps - Remove unnecessary cleanup steps - Remove unused `RESTY_OPENSSL_URL_BASE` build argument - Remove unused files after compilation
1 parent 7d5a18f commit 5344662

File tree

1 file changed

+17
-22
lines changed

1 file changed

+17
-22
lines changed

focal/Dockerfile

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,15 @@ FROM ${RESTY_IMAGE_BASE}:${RESTY_IMAGE_TAG}
88

99
LABEL maintainer="spedon <[email protected]>"
1010

11-
ENV NGX_BROTLI_COMMIT="6e975bcb015f62e1f303054897783355e2a877dc" \
12-
PATH=$PATH:/usr/local/openresty/luajit/bin:/usr/local/openresty/nginx/sbin:/usr/local/openresty/bin
13-
1411
# Docker Build Arguments
12+
ARG NGX_BROTLI_COMMIT="6e975bcb015f62e1f303054897783355e2a877dc"
1513
ARG RESTY_IMAGE_BASE="ubuntu"
1614
ARG RESTY_IMAGE_TAG="focal"
1715
ARG RESTY_VERSION="1.25.3.1"
18-
ARG RESTY_LUAROCKS_VERSION="3.9.2"
16+
ARG RESTY_LUAROCKS_VERSION="3.11.0"
1917
ARG RESTY_OPENSSL_VERSION="1.1.1w"
2018
ARG RESTY_OPENSSL_PATCH_VERSION="1.1.1f"
21-
ARG RESTY_OPENSSL_URL_BASE="https://www.openssl.org/source"
19+
ARG RESTY_OPENSSL_URL_BASE="https://www.openssl.org/source/old/1.1.1"
2220
ARG RESTY_PCRE_VERSION="8.45"
2321
ARG RESTY_PCRE_BUILD_OPTIONS="--enable-jit"
2422
ARG RESTY_PCRE_SHA256="4e6ce03e0336e8b4a3d6c2b70b1c5e18590a5673a98186da90d4f33c23defc09"
@@ -117,7 +115,20 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update \
117115
automake \
118116
${RESTY_ADD_PACKAGE_BUILDDEPS} \
119117
${RESTY_ADD_PACKAGE_RUNDEPS} \
118+
&& cd /usr/src \
119+
&& echo 'fetching ngx_brotli' \
120+
&& git clone https://github.com/google/ngx_brotli.git \
121+
&& cd ngx_brotli \
122+
&& git checkout -b ${NGX_BROTLI_COMMIT} \
123+
&& git submodule update --init --recursive \
124+
&& cd deps/brotli \
125+
&& mkdir out \
126+
&& cd out \
127+
&& echo 'building libbrotli' \
128+
&& cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DCMAKE_C_FLAGS="-Ofast -m64 -march=native -mtune=native -flto -funroll-loops -ffunction-sections -fdata-sections -Wl,--gc-sections" -DCMAKE_CXX_FLAGS="-Ofast -m64 -march=native -mtune=native -flto -funroll-loops -ffunction-sections -fdata-sections -Wl,--gc-sections" -DCMAKE_INSTALL_PREFIX=./installed .. \
129+
&& cmake --build . --config Release --target brotlienc \
120130
&& cd /tmp \
131+
&& echo 'fetching OpenSSL' \
121132
&& if [ -n "${RESTY_EVAL_PRE_CONFIGURE}" ]; then eval $(echo ${RESTY_EVAL_PRE_CONFIGURE}); fi \
122133
&& curl -fSL "${RESTY_OPENSSL_URL_BASE}/openssl-${RESTY_OPENSSL_VERSION}.tar.gz" -o openssl-${RESTY_OPENSSL_VERSION}.tar.gz \
123134
&& tar xzf openssl-${RESTY_OPENSSL_VERSION}.tar.gz \
@@ -155,20 +166,6 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update \
155166
&& cd /tmp \
156167
&& curl -fSL https://openresty.org/download/openresty-${RESTY_VERSION}.tar.gz -o openresty-${RESTY_VERSION}.tar.gz \
157168
&& tar xzf openresty-${RESTY_VERSION}.tar.gz \
158-
&& echo 'fetching libbrotli' \
159-
&& cd /usr/src \
160-
&& echo 'fetching ngx_brotli' \
161-
&& git clone https://github.com/google/ngx_brotli.git \
162-
&& cd ngx_brotli \
163-
&& git checkout -b $NGX_BROTLI_COMMIT \
164-
&& git submodule update --init --recursive \
165-
&& cd deps/brotli \
166-
&& mkdir out \
167-
&& cd out \
168-
&& echo 'building libbrotli' \
169-
&& cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DCMAKE_C_FLAGS="-Ofast -m64 -march=native -mtune=native -flto -funroll-loops -ffunction-sections -fdata-sections -Wl,--gc-sections" -DCMAKE_CXX_FLAGS="-Ofast -m64 -march=native -mtune=native -flto -funroll-loops -ffunction-sections -fdata-sections -Wl,--gc-sections" -DCMAKE_INSTALL_PREFIX=./installed .. \
170-
&& cmake --build . --config Release --target brotlienc \
171-
&& echo 'building nginx' \
172169
&& cd /tmp/openresty-${RESTY_VERSION} \
173170
&& if [ -n "${RESTY_EVAL_POST_DOWNLOAD_PRE_CONFIGURE}" ]; then eval $(echo ${RESTY_EVAL_POST_DOWNLOAD_PRE_CONFIGURE}); fi \
174171
&& eval ./configure -j${RESTY_J} ${_RESTY_CONFIG_DEPS} ${RESTY_CONFIG_OPTIONS} ${RESTY_CONFIG_OPTIONS_MORE} ${RESTY_LUAJIT_OPTIONS} ${RESTY_PCRE_OPTIONS} \
@@ -185,14 +182,12 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update \
185182
&& ./configure \
186183
--prefix=/usr/local/openresty/luajit \
187184
--with-lua=/usr/local/openresty/luajit \
188-
--lua-suffix=jit-2.1.0-beta3 \
189185
--with-lua-include=/usr/local/openresty/luajit/include/luajit-2.1 \
190186
&& make build \
191187
&& make install \
192188
&& cd /tmp \
193189
&& if [ -n "${RESTY_EVAL_POST_MAKE}" ]; then eval $(echo ${RESTY_EVAL_POST_MAKE}); fi \
194190
&& rm -rf luarocks-${RESTY_LUAROCKS_VERSION} luarocks-${RESTY_LUAROCKS_VERSION}.tar.gz \
195-
&& rm -rf /usr/src/ngx_brotli \
196191
&& if [ -n "${RESTY_ADD_PACKAGE_BUILDDEPS}" ]; then DEBIAN_FRONTEND=noninteractive apt-get remove -y --purge ${RESTY_ADD_PACKAGE_BUILDDEPS} ; fi \
197192
&& DEBIAN_FRONTEND=noninteractive apt-get autoremove -y \
198193
&& mkdir -p /var/run/openresty \
@@ -206,7 +201,7 @@ ENV PATH=$PATH:/usr/local/openresty/luajit/bin:/usr/local/openresty/nginx/sbin:/
206201
# If OpenResty changes, these may need updating:
207202
# /usr/local/openresty/bin/resty -e 'print(package.path)'
208203
# /usr/local/openresty/bin/resty -e 'print(package.cpath)'
209-
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.0-beta3/?.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"
204+
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"
210205

211206
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"
212207

0 commit comments

Comments
 (0)