|
@@ -2,7 +2,7 @@
|
|
|
# https://github.com/openresty/docker-openresty
|
|
|
|
|
|
ARG RESTY_IMAGE_BASE="alpine"
|
|
|
-ARG RESTY_IMAGE_TAG="3.13"
|
|
|
+ARG RESTY_IMAGE_TAG="3.21.3"
|
|
|
|
|
|
FROM ${RESTY_IMAGE_BASE}:${RESTY_IMAGE_TAG}
|
|
|
|
|
@@ -10,16 +10,38 @@ LABEL maintainer="Evan Wies <evan@neomantra.net>"
|
|
|
|
|
|
# Docker Build Arguments
|
|
|
ARG RESTY_IMAGE_BASE="alpine"
|
|
|
-ARG RESTY_IMAGE_TAG="3.13"
|
|
|
-ARG RESTY_VERSION="1.19.3.2"
|
|
|
-ARG RESTY_OPENSSL_VERSION="1.1.1k"
|
|
|
-ARG RESTY_OPENSSL_PATCH_VERSION="1.1.1f"
|
|
|
-ARG RESTY_OPENSSL_URL_BASE="https://www.openssl.org/source"
|
|
|
-ARG RESTY_PCRE_VERSION="8.44"
|
|
|
+ARG RESTY_IMAGE_TAG="3.21.3"
|
|
|
+ARG RESTY_VERSION="1.27.1.1"
|
|
|
+
|
|
|
+# https://github.com/openresty/openresty-packaging/blob/master/alpine/openresty-openssl3/APKBUILD
|
|
|
+ARG RESTY_OPENSSL_VERSION="3.0.16"
|
|
|
+ARG RESTY_OPENSSL_PATCH_VERSION="3.0.15"
|
|
|
+ARG RESTY_OPENSSL_URL_BASE="https://github.com/openssl/openssl/releases/download/openssl-${RESTY_OPENSSL_VERSION}"
|
|
|
+# LEGACY: "https://www.openssl.org/source/old/1.1.1"
|
|
|
+ARG RESTY_OPENSSL_BUILD_OPTIONS="enable-camellia enable-seed enable-rfc3779 enable-cms enable-md2 enable-rc5 \
|
|
|
+ enable-weak-ssl-ciphers enable-ssl3 enable-ssl3-method enable-md2 enable-ktls enable-fips \
|
|
|
+ "
|
|
|
+
|
|
|
+# https://github.com/openresty/openresty-packaging/blob/master/alpine/openresty-pcre2/APKBUILD
|
|
|
+ARG RESTY_PCRE_VERSION="10.44"
|
|
|
+ARG RESTY_PCRE_SHA256="86b9cb0aa3bcb7994faa88018292bc704cdbb708e785f7c74352ff6ea7d3175b"
|
|
|
+ARG RESTY_PCRE_BUILD_OPTIONS="--enable-jit --enable-pcre2grep-jit --disable-bsr-anycrlf --disable-coverage --disable-ebcdic --disable-fuzz-support \
|
|
|
+ --disable-jit-sealloc --disable-never-backslash-C --enable-newline-is-lf --enable-pcre2-8 --enable-pcre2-16 --enable-pcre2-32 \
|
|
|
+ --enable-pcre2grep-callout --enable-pcre2grep-callout-fork --disable-pcre2grep-libbz2 --disable-pcre2grep-libz --disable-pcre2test-libedit \
|
|
|
+ --enable-percent-zt --disable-rebuild-chartables --enable-shared --disable-static --disable-silent-rules --enable-unicode --disable-valgrind \
|
|
|
+ "
|
|
|
+
|
|
|
ARG RESTY_J="1"
|
|
|
+
|
|
|
+# https://github.com/openresty/openresty-packaging/blob/master/alpine/openresty/APKBUILD
|
|
|
ARG RESTY_CONFIG_OPTIONS="\
|
|
|
--with-compat \
|
|
|
- --with-file-aio \
|
|
|
+ --without-http_rds_json_module \
|
|
|
+ --without-http_rds_csv_module \
|
|
|
+ --without-lua_rds_parser \
|
|
|
+ --without-mail_pop3_module \
|
|
|
+ --without-mail_imap_module \
|
|
|
+ --without-mail_smtp_module \
|
|
|
--with-http_addition_module \
|
|
|
--with-http_auth_request_module \
|
|
|
--with-http_dav_module \
|
|
@@ -37,42 +59,32 @@ ARG RESTY_CONFIG_OPTIONS="\
|
|
|
--with-http_stub_status_module \
|
|
|
--with-http_sub_module \
|
|
|
--with-http_v2_module \
|
|
|
+ --with-http_v3_module \
|
|
|
--with-http_xslt_module=dynamic \
|
|
|
--with-ipv6 \
|
|
|
--with-mail \
|
|
|
--with-mail_ssl_module \
|
|
|
--with-md5-asm \
|
|
|
- --with-pcre-jit \
|
|
|
--with-sha1-asm \
|
|
|
--with-stream \
|
|
|
--with-stream_ssl_module \
|
|
|
+ --with-stream_ssl_preread_module \
|
|
|
--with-threads \
|
|
|
"
|
|
|
-ARG RESTY_CONFIG_OPTIONS_MORE="\
|
|
|
- --conf-path=/etc/nginx/nginx.conf \
|
|
|
- --error-log-path=/var/log/nginx/error.log \
|
|
|
- --http-log-path=/var/log/nginx/access.log \
|
|
|
- --pid-path=/var/run/nginx.pid \
|
|
|
- --user=www-data \
|
|
|
- --group=www-data \
|
|
|
- --with-http_iconv_module \
|
|
|
- --add-module=/tmp/nginx-ct-master \
|
|
|
- --add-module=/tmp/nginx-dav-ext-module-master \
|
|
|
- --add-module=/tmp/ngx_brotli-master \
|
|
|
- --add-module=/tmp/ngx_cache_purge-master \
|
|
|
- --add-module=/tmp/ngx_http_substitutions_filter_module-master \
|
|
|
- "
|
|
|
+ARG RESTY_CONFIG_OPTIONS_MORE=""
|
|
|
ARG RESTY_LUAJIT_OPTIONS="--with-luajit-xcflags='-DLUAJIT_NUMMODE=2 -DLUAJIT_ENABLE_LUA52COMPAT'"
|
|
|
+ARG RESTY_PCRE_OPTIONS="--with-pcre-jit"
|
|
|
|
|
|
ARG RESTY_ADD_PACKAGE_BUILDDEPS=""
|
|
|
ARG RESTY_ADD_PACKAGE_RUNDEPS=""
|
|
|
ARG RESTY_EVAL_PRE_CONFIGURE=""
|
|
|
+ARG RESTY_EVAL_POST_DOWNLOAD_PRE_CONFIGURE=""
|
|
|
ARG RESTY_EVAL_POST_MAKE=""
|
|
|
|
|
|
# These are not intended to be user-specified
|
|
|
ARG _RESTY_CONFIG_DEPS="--with-pcre \
|
|
|
- --with-cc-opt='-DNGX_LUA_ABORT_AT_PANIC -I/usr/local/openresty/pcre/include -I/usr/local/openresty/openssl/include' \
|
|
|
- --with-ld-opt='-L/usr/local/openresty/pcre/lib -L/usr/local/openresty/openssl/lib -Wl,-rpath,/usr/local/openresty/pcre/lib:/usr/local/openresty/openssl/lib' \
|
|
|
+ --with-cc-opt='-DNGX_LUA_ABORT_AT_PANIC -I/usr/local/openresty/pcre2/include -I/usr/local/openresty/openssl3/include' \
|
|
|
+ --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' \
|
|
|
"
|
|
|
|
|
|
LABEL resty_image_base="${RESTY_IMAGE_BASE}"
|
|
@@ -81,25 +93,20 @@ LABEL resty_version="${RESTY_VERSION}"
|
|
|
LABEL resty_openssl_version="${RESTY_OPENSSL_VERSION}"
|
|
|
LABEL resty_openssl_patch_version="${RESTY_OPENSSL_PATCH_VERSION}"
|
|
|
LABEL resty_openssl_url_base="${RESTY_OPENSSL_URL_BASE}"
|
|
|
+LABEL resty_openssl_build_options="${RESTY_OPENSSL_BUILD_OPTIONS}"
|
|
|
LABEL resty_pcre_version="${RESTY_PCRE_VERSION}"
|
|
|
+LABEL resty_pcre_build_options="${RESTY_PCRE_BUILD_OPTIONS}"
|
|
|
+LABEL resty_pcre_sha256="${RESTY_PCRE_SHA256}"
|
|
|
LABEL resty_config_options="${RESTY_CONFIG_OPTIONS}"
|
|
|
LABEL resty_config_options_more="${RESTY_CONFIG_OPTIONS_MORE}"
|
|
|
LABEL resty_config_deps="${_RESTY_CONFIG_DEPS}"
|
|
|
LABEL resty_add_package_builddeps="${RESTY_ADD_PACKAGE_BUILDDEPS}"
|
|
|
LABEL resty_add_package_rundeps="${RESTY_ADD_PACKAGE_RUNDEPS}"
|
|
|
LABEL resty_eval_pre_configure="${RESTY_EVAL_PRE_CONFIGURE}"
|
|
|
+LABEL resty_eval_post_download_pre_configure="${RESTY_EVAL_POST_DOWNLOAD_PRE_CONFIGURE}"
|
|
|
LABEL resty_eval_post_make="${RESTY_EVAL_POST_MAKE}"
|
|
|
-
|
|
|
-ARG CHANGE_SOURCE=false
|
|
|
-RUN if [ ${CHANGE_SOURCE} = true ]; then \
|
|
|
- # Change application source from dl-cdn.alpinelinux.org to aliyun source
|
|
|
- sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/' /etc/apk/repositories \
|
|
|
-;fi
|
|
|
-
|
|
|
-RUN set -x ; \
|
|
|
- addgroup -g 82 -S www-data ; \
|
|
|
- adduser -u 82 -D -S -G www-data www-data && exit 0 ; exit 1
|
|
|
-
|
|
|
+LABEL resty_luajit_options="${RESTY_LUAJIT_OPTIONS}"
|
|
|
+LABEL resty_pcre_options="${RESTY_PCRE_OPTIONS}"
|
|
|
|
|
|
RUN apk add --no-cache --virtual .build-deps \
|
|
|
build-base \
|
|
@@ -107,7 +114,6 @@ RUN apk add --no-cache --virtual .build-deps \
|
|
|
curl \
|
|
|
gd-dev \
|
|
|
geoip-dev \
|
|
|
- git \
|
|
|
libxslt-dev \
|
|
|
linux-headers \
|
|
|
make \
|
|
@@ -120,10 +126,8 @@ RUN apk add --no-cache --virtual .build-deps \
|
|
|
geoip \
|
|
|
libgcc \
|
|
|
libxslt \
|
|
|
+ tzdata \
|
|
|
zlib \
|
|
|
- bash \
|
|
|
- logrotate \
|
|
|
- openssl \
|
|
|
${RESTY_ADD_PACKAGE_RUNDEPS} \
|
|
|
&& cd /tmp \
|
|
|
&& if [ -n "${RESTY_EVAL_PRE_CONFIGURE}" ]; then eval $(echo ${RESTY_EVAL_PRE_CONFIGURE}); fi \
|
|
@@ -131,6 +135,10 @@ RUN apk add --no-cache --virtual .build-deps \
|
|
|
&& curl -fSL "${RESTY_OPENSSL_URL_BASE}/openssl-${RESTY_OPENSSL_VERSION}.tar.gz" -o openssl-${RESTY_OPENSSL_VERSION}.tar.gz \
|
|
|
&& tar xzf openssl-${RESTY_OPENSSL_VERSION}.tar.gz \
|
|
|
&& cd openssl-${RESTY_OPENSSL_VERSION} \
|
|
|
+ && if [ $(echo ${RESTY_OPENSSL_VERSION} | cut -c 1-4) = "3.0." ] ; then \
|
|
|
+ echo 'patching OpenSSL 3.0.15 for OpenResty' \
|
|
|
+ && curl -s https://raw.githubusercontent.com/openresty/openresty/master/patches/openssl-${RESTY_OPENSSL_PATCH_VERSION}-sess_set_get_cb_yield.patch | patch -p1 ; \
|
|
|
+ fi \
|
|
|
&& if [ $(echo ${RESTY_OPENSSL_VERSION} | cut -c 1-5) = "1.1.1" ] ; then \
|
|
|
echo 'patching OpenSSL 1.1.1 for OpenResty' \
|
|
|
&& curl -s https://raw.githubusercontent.com/openresty/openresty/master/patches/openssl-${RESTY_OPENSSL_PATCH_VERSION}-sess_set_get_cb_yield.patch | patch -p1 ; \
|
|
@@ -141,54 +149,46 @@ RUN apk add --no-cache --virtual .build-deps \
|
|
|
&& curl -s https://raw.githubusercontent.com/openresty/openresty/master/patches/openssl-${RESTY_OPENSSL_PATCH_VERSION}-sess_set_get_cb_yield.patch | patch -p1 ; \
|
|
|
fi \
|
|
|
&& ./config \
|
|
|
- no-threads shared zlib -g \
|
|
|
- enable-ssl3 enable-ssl3-method \
|
|
|
- --prefix=/usr/local/openresty/openssl \
|
|
|
+ shared zlib -g \
|
|
|
+ --prefix=/usr/local/openresty/openssl3 \
|
|
|
--libdir=lib \
|
|
|
- -Wl,-rpath,/usr/local/openresty/openssl/lib \
|
|
|
+ -Wl,-rpath,/usr/local/openresty/openssl3/lib \
|
|
|
+ ${RESTY_OPENSSL_BUILD_OPTIONS} \
|
|
|
&& make -j${RESTY_J} \
|
|
|
&& make -j${RESTY_J} install_sw \
|
|
|
&& cd /tmp \
|
|
|
- && curl -fSL https://downloads.sourceforge.net/project/pcre/pcre/${RESTY_PCRE_VERSION}/pcre-${RESTY_PCRE_VERSION}.tar.gz -o pcre-${RESTY_PCRE_VERSION}.tar.gz \
|
|
|
- && tar xzf pcre-${RESTY_PCRE_VERSION}.tar.gz \
|
|
|
- && cd /tmp/pcre-${RESTY_PCRE_VERSION} \
|
|
|
- && ./configure \
|
|
|
- --prefix=/usr/local/openresty/pcre \
|
|
|
- --disable-cpp \
|
|
|
- --enable-jit \
|
|
|
- --enable-utf \
|
|
|
- --enable-unicode-properties \
|
|
|
- && make -j${RESTY_J} \
|
|
|
- && make -j${RESTY_J} install \
|
|
|
+ && 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 \
|
|
|
+ && echo "${RESTY_PCRE_SHA256} pcre2-${RESTY_PCRE_VERSION}.tar.gz" | shasum -a 256 --check \
|
|
|
+ && tar xzf pcre2-${RESTY_PCRE_VERSION}.tar.gz \
|
|
|
+ && cd /tmp/pcre2-${RESTY_PCRE_VERSION} \
|
|
|
+ && CFLAGS="-g -O3" ./configure \
|
|
|
+ --prefix=/usr/local/openresty/pcre2 \
|
|
|
+ --libdir=/usr/local/openresty/pcre2/lib \
|
|
|
+ ${RESTY_PCRE_BUILD_OPTIONS} \
|
|
|
+ && CFLAGS="-g -O3" make -j${RESTY_J} \
|
|
|
+ && CFLAGS="-g -O3" make -j${RESTY_J} install \
|
|
|
&& cd /tmp \
|
|
|
&& curl -fSL https://openresty.org/download/openresty-${RESTY_VERSION}.tar.gz -o openresty-${RESTY_VERSION}.tar.gz \
|
|
|
&& tar xzf openresty-${RESTY_VERSION}.tar.gz \
|
|
|
- && curl -fSL https://github.com/grahamedgecombe/nginx-ct/archive/master.tar.gz -o nginx-ct.tar.gz \
|
|
|
- && tar xzf nginx-ct.tar.gz \
|
|
|
- && curl -fSL https://github.com/arut/nginx-dav-ext-module/archive/master.tar.gz -o nginx-dav-ext-module.tar.gz \
|
|
|
- && tar xzf nginx-dav-ext-module.tar.gz \
|
|
|
- && cd /tmp && git clone --recursive https://github.com/google/ngx_brotli.git ngx_brotli-master \
|
|
|
- && curl -fSL https://github.com/yaoweibin/ngx_http_substitutions_filter_module/archive/master.tar.gz -o ngx_http_substitutions_filter_module.tar.gz \
|
|
|
- && tar xzf ngx_http_substitutions_filter_module.tar.gz \
|
|
|
- && curl -fSL https://github.com/FRiCKLE/ngx_cache_purge/archive/master.tar.gz -o ngx_cache_purge.tar.gz \
|
|
|
- && tar xzf ngx_cache_purge.tar.gz \
|
|
|
&& cd /tmp/openresty-${RESTY_VERSION} \
|
|
|
- && eval ./configure -j${RESTY_J} ${_RESTY_CONFIG_DEPS} ${RESTY_CONFIG_OPTIONS} ${RESTY_CONFIG_OPTIONS_MORE} ${RESTY_LUAJIT_OPTIONS} \
|
|
|
+ && if [ -n "${RESTY_EVAL_POST_DOWNLOAD_PRE_CONFIGURE}" ]; then eval $(echo ${RESTY_EVAL_POST_DOWNLOAD_PRE_CONFIGURE}); fi \
|
|
|
+ && eval ./configure -j${RESTY_J} ${_RESTY_CONFIG_DEPS} ${RESTY_CONFIG_OPTIONS} ${RESTY_CONFIG_OPTIONS_MORE} ${RESTY_LUAJIT_OPTIONS} ${RESTY_PCRE_OPTIONS} \
|
|
|
&& make -j${RESTY_J} \
|
|
|
&& make -j${RESTY_J} install \
|
|
|
&& cd /tmp \
|
|
|
&& if [ -n "${RESTY_EVAL_POST_MAKE}" ]; then eval $(echo ${RESTY_EVAL_POST_MAKE}); fi \
|
|
|
&& rm -rf \
|
|
|
openssl-${RESTY_OPENSSL_VERSION}.tar.gz openssl-${RESTY_OPENSSL_VERSION} \
|
|
|
- pcre-${RESTY_PCRE_VERSION}.tar.gz pcre-${RESTY_PCRE_VERSION} \
|
|
|
+ pcre2-${RESTY_PCRE_VERSION}.tar.gz pcre2-${RESTY_PCRE_VERSION} \
|
|
|
openresty-${RESTY_VERSION}.tar.gz openresty-${RESTY_VERSION} \
|
|
|
&& apk del .build-deps \
|
|
|
- && mkdir -p /etc/nginx/conf.d/ /var/run/openresty/
|
|
|
+ && mkdir -p /var/run/openresty \
|
|
|
+ && ln -sf /dev/stdout /usr/local/openresty/nginx/logs/access.log \
|
|
|
+ && ln -sf /dev/stderr /usr/local/openresty/nginx/logs/error.log
|
|
|
|
|
|
# Add additional binaries into PATH for convenience
|
|
|
ENV PATH=$PATH:/usr/local/openresty/luajit/bin:/usr/local/openresty/nginx/sbin:/usr/local/openresty/bin
|
|
|
|
|
|
-
|
|
|
ARG PHP_UPSTREAM_CONTAINER=php-fpm
|
|
|
ARG PHP_UPSTREAM_PORT=9000
|
|
|
|
|
@@ -198,14 +198,11 @@ RUN touch /var/log/messages
|
|
|
# Copy 'logrotate' config file
|
|
|
COPY logrotate/nginx /etc/logrotate.d/
|
|
|
|
|
|
-# Set upstream conf and remove the default conf
|
|
|
-RUN echo "upstream php-upstream { server ${PHP_UPSTREAM_CONTAINER}:${PHP_UPSTREAM_PORT}; }" > /etc/nginx/conf.d/upstream.conf
|
|
|
-
|
|
|
# Copy nginx configuration files
|
|
|
-COPY nginx.conf /etc/nginx/
|
|
|
+COPY nginx.conf /usr/local/openresty/nginx/conf/nginx.conf
|
|
|
|
|
|
ADD ./startup.sh /opt/startup.sh
|
|
|
RUN sed -i 's/\r//g' /opt/startup.sh
|
|
|
-CMD ["/bin/bash", "/opt/startup.sh"]
|
|
|
+CMD ["/bin/sh", "/opt/startup.sh"]
|
|
|
|
|
|
EXPOSE 80 81 443
|