From 03068323dbc89fbe20ab4387fc488900a6d106c7 Mon Sep 17 00:00:00 2001 From: kv Date: Wed, 22 Sep 2021 23:34:56 +0800 Subject: [PATCH 01/27] feat: build apisix-openresty base on alpine --- Makefile | 4 + dockerfiles/Dockerfile.apisix-openresty.apk | 138 ++++++++++++++++++++ utils/build-common.sh | 8 ++ 3 files changed, 150 insertions(+) create mode 100644 dockerfiles/Dockerfile.apisix-openresty.apk diff --git a/Makefile b/Makefile index cf1754eb4..6c9182172 100644 --- a/Makefile +++ b/Makefile @@ -155,6 +155,10 @@ build-apisix-openresty-rpm: build-apisix-openresty-deb: $(call build,apisix-openresty,apisix-openresty,deb,$(local_code_path)) +.PHONY: build-apisix-openresty-apk +build-apisix-openresty-apk: + $(call build,apisix-openresty,apisix-openresty,apk,$(local_code_path)) + ### build rpm for apisix-openresty: .PHONY: package-apisix-openresty-rpm package-apisix-openresty-rpm: diff --git a/dockerfiles/Dockerfile.apisix-openresty.apk b/dockerfiles/Dockerfile.apisix-openresty.apk new file mode 100644 index 000000000..88c3d56f3 --- /dev/null +++ b/dockerfiles/Dockerfile.apisix-openresty.apk @@ -0,0 +1,138 @@ +ARG IMAGE_BASE="alpine" +ARG IMAGE_TAG="3.12" + +FROM ${IMAGE_BASE}:${IMAGE_TAG} + +COPY ./utils/build-common.sh /tmp/build-common.sh +COPY build-apisix-openresty.sh /tmp/build-apisix-openresty.sh +COPY ./utils/determine-dist.sh /tmp/determine-dist.sh + +ARG RESTY_VERSION="1.19.3.1" +ARG RESTY_OPENSSL_VERSION="1.1.1g" +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_J="1" +ARG RESTY_CONFIG_OPTIONS="\ + --with-compat \ + --with-file-aio \ + --with-http_addition_module \ + --with-http_auth_request_module \ + --with-http_dav_module \ + --with-http_flv_module \ + --with-http_geoip_module=dynamic \ + --with-http_gunzip_module \ + --with-http_gzip_static_module \ + --with-http_image_filter_module=dynamic \ + --with-http_mp4_module \ + --with-http_random_index_module \ + --with-http_realip_module \ + --with-http_secure_link_module \ + --with-http_slice_module \ + --with-http_ssl_module \ + --with-http_stub_status_module \ + --with-http_sub_module \ + --with-http_v2_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-threads \ + " +ARG RESTY_CONFIG_OPTIONS_MORE="" +ARG RESTY_LUAJIT_OPTIONS="--with-luajit-xcflags='-DLUAJIT_NUMMODE=2 -DLUAJIT_ENABLE_LUA52COMPAT'" + +ARG RESTY_ADD_PACKAGE_BUILDDEPS="" +ARG RESTY_ADD_PACKAGE_RUNDEPS="" +ARG RESTY_EVAL_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' \ + " + +LABEL resty_image_base="${RESTY_IMAGE_BASE}" +LABEL resty_image_tag="${RESTY_IMAGE_TAG}" +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_pcre_version="${RESTY_PCRE_VERSION}" +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_make="${RESTY_EVAL_POST_MAKE}" + + +RUN apk add --no-cache --virtual .build-deps \ + build-base \ + coreutils \ + curl \ + gd-dev \ + geoip-dev \ + libxslt-dev \ + linux-headers \ + make \ + perl-dev \ + readline-dev \ + zlib-dev \ + ${RESTY_ADD_PACKAGE_BUILDDEPS} \ + && apk add --no-cache \ + gd \ + geoip \ + libgcc \ + libxslt \ + zlib \ + ${RESTY_ADD_PACKAGE_RUNDEPS} \ + && cd /tmp \ + && if [ -n "${RESTY_EVAL_PRE_CONFIGURE}" ]; then eval $(echo ${RESTY_EVAL_PRE_CONFIGURE}); fi \ + && cd /tmp \ + && 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-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 ; \ + fi \ + && if [ $(echo ${RESTY_OPENSSL_VERSION} | cut -c 1-5) = "1.1.0" ] ; then \ + echo 'patching OpenSSL 1.1.0 for OpenResty' \ + && curl -s https://raw.githubusercontent.com/openresty/openresty/ed328977028c3ec3033bc25873ee360056e247cd/patches/openssl-1.1.0j-parallel_build_fix.patch | patch -p1 \ + && 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 \ + --libdir=lib \ + -Wl,-rpath,/usr/local/openresty/openssl/lib \ + && make -j${RESTY_J} \ + && make -j${RESTY_J} install_sw \ + && cd /tmp \ + && curl -fSL https://ftp.pcre.org/pub/pcre/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 \ + && ./build-common.sh build_apisix_openresty_apk \ + # determine dist and write it into /tmp/dist file + && /tmp/determine-dist.sh \ + && apk del .builddeps + + + diff --git a/utils/build-common.sh b/utils/build-common.sh index 854bc110e..837fc4f61 100755 --- a/utils/build-common.sh +++ b/utils/build-common.sh @@ -24,6 +24,11 @@ build_apisix_openresty_deb() { ./build-apisix-openresty.sh } +build_apisix_openresty_apk() { + export_openresty_variables + ./build-apisix-openresty.sh +} + export_openresty_variables() { export openssl_prefix=/usr/local/openresty/openssl111 export zlib_prefix=/usr/local/openresty/zlib @@ -42,4 +47,7 @@ build_apisix_openresty_rpm) build_apisix_openresty_deb) build_apisix_openresty_deb ;; +build_apisix_openresty_apk) + build_apisix_openresty_apk + ;; esac From 07c4293fa4d9d929adad00331e7ee3743f35f739 Mon Sep 17 00:00:00 2001 From: kv Date: Thu, 23 Sep 2021 08:22:56 +0800 Subject: [PATCH 02/27] fix --- dockerfiles/Dockerfile.apisix-openresty.apk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dockerfiles/Dockerfile.apisix-openresty.apk b/dockerfiles/Dockerfile.apisix-openresty.apk index 88c3d56f3..6b69977e5 100644 --- a/dockerfiles/Dockerfile.apisix-openresty.apk +++ b/dockerfiles/Dockerfile.apisix-openresty.apk @@ -59,7 +59,7 @@ ARG _RESTY_CONFIG_DEPS="--with-pcre \ " LABEL resty_image_base="${RESTY_IMAGE_BASE}" -LABEL resty_image_tag="${RESTY_IMAGE_TAG}" +LABEL resty_image_tag="${IMAGE_TAG}" LABEL resty_version="${RESTY_VERSION}" LABEL resty_openssl_version="${RESTY_OPENSSL_VERSION}" LABEL resty_openssl_patch_version="${RESTY_OPENSSL_PATCH_VERSION}" @@ -129,6 +129,7 @@ RUN apk add --no-cache --virtual .build-deps \ --enable-unicode-properties \ && make -j${RESTY_J} \ && make -j${RESTY_J} install \ + && cd /tmp \ && ./build-common.sh build_apisix_openresty_apk \ # determine dist and write it into /tmp/dist file && /tmp/determine-dist.sh \ From 3c45b07fe140d055da43eccd2806065ba704b814 Mon Sep 17 00:00:00 2001 From: kv Date: Thu, 23 Sep 2021 16:46:21 +0800 Subject: [PATCH 03/27] fix: add bash --- dockerfiles/Dockerfile.apisix-openresty.apk | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/dockerfiles/Dockerfile.apisix-openresty.apk b/dockerfiles/Dockerfile.apisix-openresty.apk index 6b69977e5..519b53e2d 100644 --- a/dockerfiles/Dockerfile.apisix-openresty.apk +++ b/dockerfiles/Dockerfile.apisix-openresty.apk @@ -93,6 +93,7 @@ RUN apk add --no-cache --virtual .build-deps \ libgcc \ libxslt \ zlib \ + bash \ ${RESTY_ADD_PACKAGE_RUNDEPS} \ && cd /tmp \ && if [ -n "${RESTY_EVAL_PRE_CONFIGURE}" ]; then eval $(echo ${RESTY_EVAL_PRE_CONFIGURE}); fi \ @@ -134,6 +135,3 @@ RUN apk add --no-cache --virtual .build-deps \ # determine dist and write it into /tmp/dist file && /tmp/determine-dist.sh \ && apk del .builddeps - - - From 2ed12295723f66c974eee9bbb5cad4a27b36a1e8 Mon Sep 17 00:00:00 2001 From: kv Date: Thu, 23 Sep 2021 17:07:21 +0800 Subject: [PATCH 04/27] add git --- dockerfiles/Dockerfile.apisix-openresty.apk | 1 + 1 file changed, 1 insertion(+) diff --git a/dockerfiles/Dockerfile.apisix-openresty.apk b/dockerfiles/Dockerfile.apisix-openresty.apk index 519b53e2d..d8fb2fefb 100644 --- a/dockerfiles/Dockerfile.apisix-openresty.apk +++ b/dockerfiles/Dockerfile.apisix-openresty.apk @@ -94,6 +94,7 @@ RUN apk add --no-cache --virtual .build-deps \ libxslt \ zlib \ bash \ + git \ ${RESTY_ADD_PACKAGE_RUNDEPS} \ && cd /tmp \ && if [ -n "${RESTY_EVAL_PRE_CONFIGURE}" ]; then eval $(echo ${RESTY_EVAL_PRE_CONFIGURE}); fi \ From 24dcd7738be03dfee250b813801215ae2eeae43c Mon Sep 17 00:00:00 2001 From: kv Date: Thu, 23 Sep 2021 21:08:14 +0800 Subject: [PATCH 05/27] debug dockerfile --- dockerfiles/Dockerfile.apisix-openresty.apk | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/dockerfiles/Dockerfile.apisix-openresty.apk b/dockerfiles/Dockerfile.apisix-openresty.apk index d8fb2fefb..b2fb4c6b9 100644 --- a/dockerfiles/Dockerfile.apisix-openresty.apk +++ b/dockerfiles/Dockerfile.apisix-openresty.apk @@ -47,8 +47,6 @@ ARG RESTY_CONFIG_OPTIONS="\ ARG RESTY_CONFIG_OPTIONS_MORE="" ARG RESTY_LUAJIT_OPTIONS="--with-luajit-xcflags='-DLUAJIT_NUMMODE=2 -DLUAJIT_ENABLE_LUA52COMPAT'" -ARG RESTY_ADD_PACKAGE_BUILDDEPS="" -ARG RESTY_ADD_PACKAGE_RUNDEPS="" ARG RESTY_EVAL_PRE_CONFIGURE="" ARG RESTY_EVAL_POST_MAKE="" @@ -68,8 +66,6 @@ LABEL resty_pcre_version="${RESTY_PCRE_VERSION}" 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_make="${RESTY_EVAL_POST_MAKE}" @@ -86,7 +82,6 @@ RUN apk add --no-cache --virtual .build-deps \ perl-dev \ readline-dev \ zlib-dev \ - ${RESTY_ADD_PACKAGE_BUILDDEPS} \ && apk add --no-cache \ gd \ geoip \ @@ -94,9 +89,9 @@ RUN apk add --no-cache --virtual .build-deps \ libxslt \ zlib \ bash \ - git \ - ${RESTY_ADD_PACKAGE_RUNDEPS} \ - && cd /tmp \ + git + +RUN cd /tmp \ && if [ -n "${RESTY_EVAL_PRE_CONFIGURE}" ]; then eval $(echo ${RESTY_EVAL_PRE_CONFIGURE}); fi \ && cd /tmp \ && curl -fSL "${RESTY_OPENSSL_URL_BASE}/openssl-${RESTY_OPENSSL_VERSION}.tar.gz" -o openssl-${RESTY_OPENSSL_VERSION}.tar.gz \ @@ -118,8 +113,9 @@ RUN apk add --no-cache --virtual .build-deps \ --libdir=lib \ -Wl,-rpath,/usr/local/openresty/openssl/lib \ && make -j${RESTY_J} \ - && make -j${RESTY_J} install_sw \ - && cd /tmp \ + && make -j${RESTY_J} install_sw + +RUN cd /tmp \ && curl -fSL https://ftp.pcre.org/pub/pcre/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} \ @@ -130,8 +126,9 @@ RUN apk add --no-cache --virtual .build-deps \ --enable-utf \ --enable-unicode-properties \ && make -j${RESTY_J} \ - && make -j${RESTY_J} install \ - && cd /tmp \ + && make -j${RESTY_J} install + +RUN cd /tmp \ && ./build-common.sh build_apisix_openresty_apk \ # determine dist and write it into /tmp/dist file && /tmp/determine-dist.sh \ From ca872bc40dd79ae4a600e47ca083d01960921c68 Mon Sep 17 00:00:00 2001 From: kv Date: Thu, 23 Sep 2021 22:33:51 +0800 Subject: [PATCH 06/27] add curl --- dockerfiles/Dockerfile.apisix-openresty.apk | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dockerfiles/Dockerfile.apisix-openresty.apk b/dockerfiles/Dockerfile.apisix-openresty.apk index b2fb4c6b9..3f074752d 100644 --- a/dockerfiles/Dockerfile.apisix-openresty.apk +++ b/dockerfiles/Dockerfile.apisix-openresty.apk @@ -89,7 +89,8 @@ RUN apk add --no-cache --virtual .build-deps \ libxslt \ zlib \ bash \ - git + git \ + curl RUN cd /tmp \ && if [ -n "${RESTY_EVAL_PRE_CONFIGURE}" ]; then eval $(echo ${RESTY_EVAL_PRE_CONFIGURE}); fi \ @@ -127,7 +128,7 @@ RUN cd /tmp \ --enable-unicode-properties \ && make -j${RESTY_J} \ && make -j${RESTY_J} install - + RUN cd /tmp \ && ./build-common.sh build_apisix_openresty_apk \ # determine dist and write it into /tmp/dist file From c43dbc7b2a1a239635d6503cc20057d60695e4c9 Mon Sep 17 00:00:00 2001 From: kv Date: Thu, 23 Sep 2021 22:51:14 +0800 Subject: [PATCH 07/27] debug: curl version --- dockerfiles/Dockerfile.apisix-openresty.apk | 1 + 1 file changed, 1 insertion(+) diff --git a/dockerfiles/Dockerfile.apisix-openresty.apk b/dockerfiles/Dockerfile.apisix-openresty.apk index 3f074752d..aeb570218 100644 --- a/dockerfiles/Dockerfile.apisix-openresty.apk +++ b/dockerfiles/Dockerfile.apisix-openresty.apk @@ -130,6 +130,7 @@ RUN cd /tmp \ && make -j${RESTY_J} install RUN cd /tmp \ + && curl --version \ && ./build-common.sh build_apisix_openresty_apk \ # determine dist and write it into /tmp/dist file && /tmp/determine-dist.sh \ From 268de16b2c64789ae5f75a86927057c6f11c3a45 Mon Sep 17 00:00:00 2001 From: kv Date: Fri, 24 Sep 2021 00:03:40 +0800 Subject: [PATCH 08/27] debug: add or_prefix --- utils/build-common.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/utils/build-common.sh b/utils/build-common.sh index 837fc4f61..9ea6ec885 100755 --- a/utils/build-common.sh +++ b/utils/build-common.sh @@ -33,6 +33,7 @@ export_openresty_variables() { export openssl_prefix=/usr/local/openresty/openssl111 export zlib_prefix=/usr/local/openresty/zlib export pcre_prefix=/usr/local/openresty/pcre + export OR_PREFIX=/usr/local/openresty export cc_opt="-DNGX_LUA_ABORT_AT_PANIC -I${zlib_prefix}/include -I${pcre_prefix}/include -I${openssl_prefix}/include" export ld_opt="-L${zlib_prefix}/lib -L${pcre_prefix}/lib -L${openssl_prefix}/lib -Wl,-rpath,${zlib_prefix}/lib:${pcre_prefix}/lib:${openssl_prefix}/lib" From 6e4c6992d5038c968f80d8ae2e5aba8d05a90d39 Mon Sep 17 00:00:00 2001 From: kv Date: Sat, 25 Sep 2021 15:56:09 +0800 Subject: [PATCH 09/27] debug --- dockerfiles/Dockerfile.apisix-openresty.apk | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/dockerfiles/Dockerfile.apisix-openresty.apk b/dockerfiles/Dockerfile.apisix-openresty.apk index aeb570218..8a7378169 100644 --- a/dockerfiles/Dockerfile.apisix-openresty.apk +++ b/dockerfiles/Dockerfile.apisix-openresty.apk @@ -129,9 +129,4 @@ RUN cd /tmp \ && make -j${RESTY_J} \ && make -j${RESTY_J} install -RUN cd /tmp \ - && curl --version \ - && ./build-common.sh build_apisix_openresty_apk \ - # determine dist and write it into /tmp/dist file - && /tmp/determine-dist.sh \ - && apk del .builddeps +CMD /bin/sh From abc71c9f08c9c1beea743a5b43fa12a537f91a22 Mon Sep 17 00:00:00 2001 From: kv Date: Sat, 25 Sep 2021 17:46:46 +0800 Subject: [PATCH 10/27] debug --- dockerfiles/Dockerfile.apisix-openresty.apk | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/dockerfiles/Dockerfile.apisix-openresty.apk b/dockerfiles/Dockerfile.apisix-openresty.apk index 8a7378169..d8c5f2a4e 100644 --- a/dockerfiles/Dockerfile.apisix-openresty.apk +++ b/dockerfiles/Dockerfile.apisix-openresty.apk @@ -52,8 +52,8 @@ 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/pcre/include -I/usr/local/openresty/openssl111/include' \ + --with-ld-opt='-L/usr/local/openresty/pcre/lib -L/usr/local/openresty/openssl111/lib -Wl,-rpath,/usr/local/openresty/pcre/lib:/usr/local/openresty/openssl111/lib' \ " LABEL resty_image_base="${RESTY_IMAGE_BASE}" @@ -110,9 +110,9 @@ RUN cd /tmp \ && ./config \ no-threads shared zlib -g \ enable-ssl3 enable-ssl3-method \ - --prefix=/usr/local/openresty/openssl \ + --prefix=/usr/local/openresty/openssl111 \ --libdir=lib \ - -Wl,-rpath,/usr/local/openresty/openssl/lib \ + -Wl,-rpath,/usr/local/openresty/openssl111/lib \ && make -j${RESTY_J} \ && make -j${RESTY_J} install_sw @@ -129,4 +129,8 @@ RUN cd /tmp \ && make -j${RESTY_J} \ && make -j${RESTY_J} install +RUN cd /tmp \ + && curl --version \ + && ./build-common.sh build_apisix_openresty_apk + CMD /bin/sh From bc258faa41ff5f68aab35063f70fc738d3b8f323 Mon Sep 17 00:00:00 2001 From: kv Date: Sat, 25 Sep 2021 18:22:00 +0800 Subject: [PATCH 11/27] add sudo --- dockerfiles/Dockerfile.apisix-openresty.apk | 1 + 1 file changed, 1 insertion(+) diff --git a/dockerfiles/Dockerfile.apisix-openresty.apk b/dockerfiles/Dockerfile.apisix-openresty.apk index d8c5f2a4e..8bfe30c1a 100644 --- a/dockerfiles/Dockerfile.apisix-openresty.apk +++ b/dockerfiles/Dockerfile.apisix-openresty.apk @@ -90,6 +90,7 @@ RUN apk add --no-cache --virtual .build-deps \ zlib \ bash \ git \ + sudo \ curl RUN cd /tmp \ From a71ff23afbf16ca1eb2b1c2995c9441192790b3d Mon Sep 17 00:00:00 2001 From: kv Date: Sat, 25 Sep 2021 18:38:42 +0800 Subject: [PATCH 12/27] only openssl111 --- dockerfiles/Dockerfile.apisix-openresty.apk | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/dockerfiles/Dockerfile.apisix-openresty.apk b/dockerfiles/Dockerfile.apisix-openresty.apk index 8bfe30c1a..ca30389a6 100644 --- a/dockerfiles/Dockerfile.apisix-openresty.apk +++ b/dockerfiles/Dockerfile.apisix-openresty.apk @@ -99,15 +99,8 @@ RUN cd /tmp \ && 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-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 ; \ - fi \ - && if [ $(echo ${RESTY_OPENSSL_VERSION} | cut -c 1-5) = "1.1.0" ] ; then \ - echo 'patching OpenSSL 1.1.0 for OpenResty' \ - && curl -s https://raw.githubusercontent.com/openresty/openresty/ed328977028c3ec3033bc25873ee360056e247cd/patches/openssl-1.1.0j-parallel_build_fix.patch | patch -p1 \ - && curl -s https://raw.githubusercontent.com/openresty/openresty/master/patches/openssl-${RESTY_OPENSSL_PATCH_VERSION}-sess_set_get_cb_yield.patch | patch -p1 ; \ - fi \ + && 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 ; \ && ./config \ no-threads shared zlib -g \ enable-ssl3 enable-ssl3-method \ From 32bc2ecaa69a7bfe4203598080655380400e823a Mon Sep 17 00:00:00 2001 From: kv Date: Sat, 25 Sep 2021 18:43:58 +0800 Subject: [PATCH 13/27] fix --- dockerfiles/Dockerfile.apisix-openresty.apk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockerfiles/Dockerfile.apisix-openresty.apk b/dockerfiles/Dockerfile.apisix-openresty.apk index ca30389a6..5039010a6 100644 --- a/dockerfiles/Dockerfile.apisix-openresty.apk +++ b/dockerfiles/Dockerfile.apisix-openresty.apk @@ -100,7 +100,7 @@ RUN cd /tmp \ && tar xzf openssl-${RESTY_OPENSSL_VERSION}.tar.gz \ && cd openssl-${RESTY_OPENSSL_VERSION} \ && 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 ; \ + && curl -s https://raw.githubusercontent.com/openresty/openresty/master/patches/openssl-${RESTY_OPENSSL_PATCH_VERSION}-sess_set_get_cb_yield.patch | patch -p1 \ && ./config \ no-threads shared zlib -g \ enable-ssl3 enable-ssl3-method \ From 48b4801a12ec3bb6a5c2f096d50d78577572150e Mon Sep 17 00:00:00 2001 From: kv Date: Sun, 26 Sep 2021 08:56:54 +0800 Subject: [PATCH 14/27] add apisix-alpine build script --- Makefile | 13 +++++++ dockerfiles/Dockerfile.apisix.alpine | 54 ++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 dockerfiles/Dockerfile.apisix.alpine diff --git a/Makefile b/Makefile index 6c9182172..3e8bfde6f 100644 --- a/Makefile +++ b/Makefile @@ -115,6 +115,14 @@ package-apisix-rpm: package-apisix-deb: $(call package,apisix,deb) + +### build apisix image base alpine: +.PHONY: build-apisix-alpine-image +build-apisix-alpine-image: + $(call build,apisix-openresty,apisix-openresty,apk,$(local_code_path)) + $(call build,apisix,apisix,alpine,$(local_code_path)) + + ### build dashboard: .PHONY: build-dashboard-rpm build-dashboard-rpm: @@ -225,4 +233,9 @@ package: build-fpm package: build-dashboard-deb package: package-dashboard-deb +else ifeq ($(app)_$(type),apisix_) +package: build-fpm +package: build-dashboard-deb +package: package-dashboard-deb + endif diff --git a/dockerfiles/Dockerfile.apisix.alpine b/dockerfiles/Dockerfile.apisix.alpine new file mode 100644 index 000000000..479af45f1 --- /dev/null +++ b/dockerfiles/Dockerfile.apisix.alpine @@ -0,0 +1,54 @@ +ARG ENABLE_PROXY=false +ARG VERSION + +FROM apache/apisix-alpine:${VERSION} AS production-stage + +ARG APISIX_VERSION=2.9 +LABEL apisix_version="${APISIX_VERSION}" + +ARG ENABLE_PROXY +RUN set -x \ + && (test "${ENABLE_PROXY}" != "true" || /bin/sed -i 's,http://dl-cdn.alpinelinux.org,https://mirrors.aliyun.com,g' /etc/apk/repositories) \ + && apk add --no-cache --virtual .builddeps \ + automake \ + autoconf \ + libtool \ + pkgconfig \ + cmake \ + git \ + pcre \ + pcre-dev \ + && mkdir ~/.luarocks \ + && luarocks config variables.OPENSSL_LIBDIR /usr/local/openresty/openssl/lib \ + && luarocks config variables.OPENSSL_INCDIR /usr/local/openresty/openssl/include \ + && luarocks install https://github.com/apache/apisix/raw/master/rockspec/apisix-${APISIX_VERSION}-0.rockspec --tree=/usr/local/apisix/deps \ + && cp -v /usr/local/apisix/deps/lib/luarocks/rocks-5.1/apisix/${APISIX_VERSION}-0/bin/apisix /usr/bin/ \ + && (if [ "$APISIX_VERSION" = "master" ] || [ "$APISIX_VERSION" \> "2.2" ]; then echo 'use shell ';else bin='#! /usr/local/openresty/luajit/bin/luajit\npackage.path = "/usr/local/apisix/?.lua;" .. package.path'; sed -i "1s@.*@$bin@" /usr/bin/apisix ; fi;) \ + && mv /usr/local/apisix/deps/share/lua/5.1/apisix /usr/local/apisix \ + && apk del .builddeps build-base make unzip + +FROM alpine:3.13 AS last-stage + +ARG ENABLE_PROXY +# add runtime for Apache APISIX +RUN set -x \ + && (test "${ENABLE_PROXY}" != "true" || /bin/sed -i 's,http://dl-cdn.alpinelinux.org,https://mirrors.aliyun.com,g' /etc/apk/repositories) \ + && apk add --no-cache bash libstdc++ curl tzdata + +WORKDIR /usr/local/apisix + +COPY --from=production-stage /usr/local/openresty/ /usr/local/openresty/ +COPY --from=production-stage /usr/local/apisix/ /usr/local/apisix/ +COPY --from=production-stage /usr/bin/apisix /usr/bin/apisix + +# forward request and error logs to docker log collector +RUN ln -sf /dev/stdout /usr/local/apisix/logs/access.log \ + && ln -sf /dev/stderr /usr/local/apisix/logs/error.log + +ENV PATH=$PATH:/usr/local/openresty/luajit/bin:/usr/local/openresty/nginx/sbin:/usr/local/openresty/bin + +EXPOSE 9080 9443 + +CMD ["sh", "-c", "/usr/bin/apisix init && /usr/bin/apisix init_etcd && /usr/local/openresty/bin/openresty -p /usr/local/apisix -g 'daemon off;'"] + +STOPSIGNAL SIGQUIT From 97f7b9477ec14342d2a296d548dc7339b76eed75 Mon Sep 17 00:00:00 2001 From: kv Date: Sun, 26 Sep 2021 09:52:38 +0800 Subject: [PATCH 15/27] fix: the image name of apisix-openresty which is based by apisix-alpine --- Makefile | 31 +++++++++++++++++++++++++++- dockerfiles/Dockerfile.apisix.alpine | 5 +++-- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 3e8bfde6f..43d00187d 100644 --- a/Makefile +++ b/Makefile @@ -24,6 +24,7 @@ image_tag="7" iteration=0 local_code_path=0 openresty="openresty" +openresty_version="1.19.3.2.0" artifact="0" apisix_repo="https://github.com/apache/apisix" dashboard_repo="https://github.com/apache/apisix-dashboard" @@ -67,6 +68,34 @@ define build endef endif +### function for building image +### $(1) is name +### $(2) is dockerfile filename +### $(3) is package type +### $(4) is openresty image name +### $(5) is openresty image version +### $(6) is code path +ifneq ($(buildx), True) +define build-image + docker build -t apache/$(1)-$(3):$(version) \ + --build-arg OPENRESTY_NAME=$(4) \ + --build-arg OPENRESTY_VERSION=$(5) \ + --build-arg CODE_PATH=$(6) \ + -f ./dockerfiles/Dockerfile.$(2).$(3) . +endef +else +define build-image + docker buildx build -t apache/$(1)-$(3):$(version) \ + --build-arg OPENRESTY_NAME=$(4) \ + --build-arg OPENRESTY_VERSION=$(5) \ + --build-arg CODE_PATH=$(6) \ + --load \ + --cache-from=$(cache_from) \ + --cache-to=$(cache_to) \ + -f ./dockerfiles/Dockerfile.$(2).$(3) . +endef +endif + ### function for packing ### $(1) is name ### $(2) is package type @@ -120,7 +149,7 @@ package-apisix-deb: .PHONY: build-apisix-alpine-image build-apisix-alpine-image: $(call build,apisix-openresty,apisix-openresty,apk,$(local_code_path)) - $(call build,apisix,apisix,alpine,$(local_code_path)) + $(call build-image,apisix,apisix,alpine,apisix-openresty,$(openresty_version),$(local_code_path)) ### build dashboard: diff --git a/dockerfiles/Dockerfile.apisix.alpine b/dockerfiles/Dockerfile.apisix.alpine index 479af45f1..5d11ef831 100644 --- a/dockerfiles/Dockerfile.apisix.alpine +++ b/dockerfiles/Dockerfile.apisix.alpine @@ -1,7 +1,8 @@ ARG ENABLE_PROXY=false -ARG VERSION +ARG OPENRESTY_VERSION +ARG OPENRESTY_NAME -FROM apache/apisix-alpine:${VERSION} AS production-stage +FROM apache/${OPENRESTY_NAME}:${OPENRESTY_VERSION} AS production-stage ARG APISIX_VERSION=2.9 LABEL apisix_version="${APISIX_VERSION}" From 7ac167200dd3b0066f4df49b2344909f70981373 Mon Sep 17 00:00:00 2001 From: kv Date: Wed, 13 Oct 2021 19:19:55 +0800 Subject: [PATCH 16/27] remove unused arg/labels --- dockerfiles/Dockerfile.apisix-openresty.apk | 50 +-------------------- 1 file changed, 2 insertions(+), 48 deletions(-) diff --git a/dockerfiles/Dockerfile.apisix-openresty.apk b/dockerfiles/Dockerfile.apisix-openresty.apk index 5039010a6..67fd1b0c9 100644 --- a/dockerfiles/Dockerfile.apisix-openresty.apk +++ b/dockerfiles/Dockerfile.apisix-openresty.apk @@ -7,67 +7,21 @@ COPY ./utils/build-common.sh /tmp/build-common.sh COPY build-apisix-openresty.sh /tmp/build-apisix-openresty.sh COPY ./utils/determine-dist.sh /tmp/determine-dist.sh -ARG RESTY_VERSION="1.19.3.1" + ARG RESTY_OPENSSL_VERSION="1.1.1g" 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_J="1" -ARG RESTY_CONFIG_OPTIONS="\ - --with-compat \ - --with-file-aio \ - --with-http_addition_module \ - --with-http_auth_request_module \ - --with-http_dav_module \ - --with-http_flv_module \ - --with-http_geoip_module=dynamic \ - --with-http_gunzip_module \ - --with-http_gzip_static_module \ - --with-http_image_filter_module=dynamic \ - --with-http_mp4_module \ - --with-http_random_index_module \ - --with-http_realip_module \ - --with-http_secure_link_module \ - --with-http_slice_module \ - --with-http_ssl_module \ - --with-http_stub_status_module \ - --with-http_sub_module \ - --with-http_v2_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-threads \ - " -ARG RESTY_CONFIG_OPTIONS_MORE="" -ARG RESTY_LUAJIT_OPTIONS="--with-luajit-xcflags='-DLUAJIT_NUMMODE=2 -DLUAJIT_ENABLE_LUA52COMPAT'" - ARG RESTY_EVAL_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/openssl111/include' \ - --with-ld-opt='-L/usr/local/openresty/pcre/lib -L/usr/local/openresty/openssl111/lib -Wl,-rpath,/usr/local/openresty/pcre/lib:/usr/local/openresty/openssl111/lib' \ - " LABEL resty_image_base="${RESTY_IMAGE_BASE}" LABEL resty_image_tag="${IMAGE_TAG}" -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_pcre_version="${RESTY_PCRE_VERSION}" -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_eval_pre_configure="${RESTY_EVAL_PRE_CONFIGURE}" -LABEL resty_eval_post_make="${RESTY_EVAL_POST_MAKE}" RUN apk add --no-cache --virtual .build-deps \ @@ -127,4 +81,4 @@ RUN cd /tmp \ && curl --version \ && ./build-common.sh build_apisix_openresty_apk -CMD /bin/sh +CMD /bin/sh \ No newline at end of file From dfa65e0aec3a7e42c898ae8494efc6bf5f99e1e2 Mon Sep 17 00:00:00 2001 From: kv Date: Wed, 13 Oct 2021 20:00:26 +0800 Subject: [PATCH 17/27] rename apisix-openresty to apisix-base --- dockerfiles/Dockerfile.apisix-openresty.apk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockerfiles/Dockerfile.apisix-openresty.apk b/dockerfiles/Dockerfile.apisix-openresty.apk index a7fc915de..278b6413f 100644 --- a/dockerfiles/Dockerfile.apisix-openresty.apk +++ b/dockerfiles/Dockerfile.apisix-openresty.apk @@ -4,7 +4,7 @@ ARG IMAGE_TAG="3.12" FROM ${IMAGE_BASE}:${IMAGE_TAG} COPY ./utils/build-common.sh /tmp/build-common.sh -COPY build-apisix-openresty.sh /tmp/build-apisix-openresty.sh +COPY build-apisix-base.sh /tmp/build-apisix-base.sh COPY ./utils/determine-dist.sh /tmp/determine-dist.sh From e4e09b17049151384840cb5cc27ac9504584b865 Mon Sep 17 00:00:00 2001 From: kv Date: Wed, 13 Oct 2021 20:08:59 +0800 Subject: [PATCH 18/27] modify makefile --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index fc6b0ee06..f67e12f5b 100644 --- a/Makefile +++ b/Makefile @@ -221,10 +221,10 @@ build-fpm: endif ifeq ($(filter $(app),apisix dashboard apisix-base),) -$(info the app's value have to be apisix or dashboard!) +$(info the app's value have to be apisix, dashboard or apisix-base!) -else ifeq ($(filter $(type),rpm deb),) -$(info the type's value have to be rpm or deb!) +else ifeq ($(filter $(type),rpm deb apk),) +$(info the type's value have to be rpm, deb or apk!) else ifeq ($(version), 0) $(info you have to input a version value!) From 11bf9ae1fe0239cc36e26ee7129ed7e60cb35fac Mon Sep 17 00:00:00 2001 From: kv Date: Wed, 13 Oct 2021 21:42:07 +0800 Subject: [PATCH 19/27] modify makefile --- Makefile | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index f67e12f5b..5de07ed4d 100644 --- a/Makefile +++ b/Makefile @@ -144,14 +144,6 @@ package-apisix-rpm: package-apisix-deb: $(call package,apisix,deb) - -### build apisix image base alpine: -.PHONY: build-apisix-alpine-image -build-apisix-alpine-image: - $(call build,apisix-openresty,apisix-openresty,apk,$(local_code_path)) - $(call build-image,apisix,apisix,alpine,apisix-openresty,$(openresty_version),$(local_code_path)) - - ### build dashboard: .PHONY: build-dashboard-rpm build-dashboard-rpm: @@ -239,6 +231,9 @@ package: build-fpm package: build-apisix-base-deb package: package-apisix-base-deb +else ifeq ($(app)_$(type),apisix-base_apk) +package: build-apisix-base-apk + else ifeq ($(checkout), 0) $(info you have to input a checkout value!) From d46c95a766a742c56d09b761c7cf731913d33dba Mon Sep 17 00:00:00 2001 From: kv Date: Wed, 13 Oct 2021 21:44:02 +0800 Subject: [PATCH 20/27] rename apisix-base --- ...Dockerfile.apisix-openresty.apk => Dockerfile.apisix-base.apk} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename dockerfiles/{Dockerfile.apisix-openresty.apk => Dockerfile.apisix-base.apk} (100%) diff --git a/dockerfiles/Dockerfile.apisix-openresty.apk b/dockerfiles/Dockerfile.apisix-base.apk similarity index 100% rename from dockerfiles/Dockerfile.apisix-openresty.apk rename to dockerfiles/Dockerfile.apisix-base.apk From 8a180f2fa78f6f460e5a324d21ba176aa46725eb Mon Sep 17 00:00:00 2001 From: kv Date: Wed, 13 Oct 2021 22:24:21 +0800 Subject: [PATCH 21/27] add build-base in alpine --- dockerfiles/Dockerfile.apisix-base.apk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dockerfiles/Dockerfile.apisix-base.apk b/dockerfiles/Dockerfile.apisix-base.apk index 278b6413f..186ae09c8 100644 --- a/dockerfiles/Dockerfile.apisix-base.apk +++ b/dockerfiles/Dockerfile.apisix-base.apk @@ -45,7 +45,8 @@ RUN apk add --no-cache --virtual .build-deps \ bash \ git \ sudo \ - curl + curl \ + build-base RUN cd /tmp \ && if [ -n "${RESTY_EVAL_PRE_CONFIGURE}" ]; then eval $(echo ${RESTY_EVAL_PRE_CONFIGURE}); fi \ From e81352bf70fed6807cf0c115fc2b2b7d53f63c0d Mon Sep 17 00:00:00 2001 From: kv Date: Thu, 14 Oct 2021 08:46:36 +0800 Subject: [PATCH 22/27] add g++ --- dockerfiles/Dockerfile.apisix-base.apk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dockerfiles/Dockerfile.apisix-base.apk b/dockerfiles/Dockerfile.apisix-base.apk index 186ae09c8..d286025fd 100644 --- a/dockerfiles/Dockerfile.apisix-base.apk +++ b/dockerfiles/Dockerfile.apisix-base.apk @@ -46,7 +46,8 @@ RUN apk add --no-cache --virtual .build-deps \ git \ sudo \ curl \ - build-base + build-base \ + g++ RUN cd /tmp \ && if [ -n "${RESTY_EVAL_PRE_CONFIGURE}" ]; then eval $(echo ${RESTY_EVAL_PRE_CONFIGURE}); fi \ From 0a10d68f82ac88a23cbe0f51823312d95406fc98 Mon Sep 17 00:00:00 2001 From: kv Date: Thu, 14 Oct 2021 09:12:00 +0800 Subject: [PATCH 23/27] add libc6-compat --- dockerfiles/Dockerfile.apisix-base.apk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dockerfiles/Dockerfile.apisix-base.apk b/dockerfiles/Dockerfile.apisix-base.apk index d286025fd..228136330 100644 --- a/dockerfiles/Dockerfile.apisix-base.apk +++ b/dockerfiles/Dockerfile.apisix-base.apk @@ -47,7 +47,8 @@ RUN apk add --no-cache --virtual .build-deps \ sudo \ curl \ build-base \ - g++ + g++ \ + libc6-compat RUN cd /tmp \ && if [ -n "${RESTY_EVAL_PRE_CONFIGURE}" ]; then eval $(echo ${RESTY_EVAL_PRE_CONFIGURE}); fi \ From c25766065134211075e705ae7ae526b32dda4918 Mon Sep 17 00:00:00 2001 From: kv Date: Fri, 15 Oct 2021 12:00:45 +0800 Subject: [PATCH 24/27] use alpine-pkg-glibc --- build-apisix-base.sh | 21 ++++++++++++--------- dockerfiles/Dockerfile.apisix-base.apk | 12 +++++++++--- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/build-apisix-base.sh b/build-apisix-base.sh index 90d0a964c..d02f153f0 100755 --- a/build-apisix-base.sh +++ b/build-apisix-base.sh @@ -29,6 +29,17 @@ or_ver="1.19.3.2" wget --no-check-certificate https://openresty.org/download/openresty-${or_ver}.tar.gz tar -zxvpf openresty-${or_ver}.tar.gz +if [ "$repo" == wasm-nginx-module ]; then + cp -r "$prev_workdir" . +else + git clone --depth=1 $wasm_nginx_module_ver \ + https://github.com/api7/wasm-nginx-module.git +fi + +cd wasm-nginx-module || exit 1 +./install-wasmtime.sh +cd .. + if [ "$repo" == ngx_multi_upstream_module ]; then cp -r "$prev_workdir" . else @@ -50,12 +61,7 @@ else https://github.com/api7/apisix-nginx-module.git fi -if [ "$repo" == wasm-nginx-module ]; then - cp -r "$prev_workdir" . -else - git clone --depth=1 $wasm_nginx_module_ver \ - https://github.com/api7/wasm-nginx-module.git -fi + if [ "$repo" == lua-var-nginx-module ]; then cp -r "$prev_workdir" . @@ -72,9 +78,6 @@ cd apisix-nginx-module/patch || exit 1 ./patch.sh ../../openresty-${or_ver} cd ../.. -cd wasm-nginx-module || exit 1 -./install-wasmtime.sh -cd .. version=${version:-0.0.0} cc_opt=${cc_opt:-} diff --git a/dockerfiles/Dockerfile.apisix-base.apk b/dockerfiles/Dockerfile.apisix-base.apk index 228136330..53b9228e0 100644 --- a/dockerfiles/Dockerfile.apisix-base.apk +++ b/dockerfiles/Dockerfile.apisix-base.apk @@ -39,7 +39,6 @@ RUN apk add --no-cache --virtual .build-deps \ && apk add --no-cache \ gd \ geoip \ - libgcc \ libxslt \ zlib \ bash \ @@ -47,8 +46,15 @@ RUN apk add --no-cache --virtual .build-deps \ sudo \ curl \ build-base \ - g++ \ - libc6-compat + libstdc++ + +RUN cd /tmp \ + && GLIBC_VER="2.29-r0" && \ + wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub && \ + wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VER}/glibc-${GLIBC_VER}.apk && \ + wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VER}/glibc-bin-${GLIBC_VER}.apk && \ + wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VER}/glibc-i18n-${GLIBC_VER}.apk && \ + apk add glibc-bin-${GLIBC_VER}.apk glibc-i18n-${GLIBC_VER}.apk glibc-${GLIBC_VER}.apk RUN cd /tmp \ && if [ -n "${RESTY_EVAL_PRE_CONFIGURE}" ]; then eval $(echo ${RESTY_EVAL_PRE_CONFIGURE}); fi \ From 553a62ac83d02ab2894b4b1de1bd8d1b52b8d58f Mon Sep 17 00:00:00 2001 From: kv Date: Fri, 15 Oct 2021 12:16:44 +0800 Subject: [PATCH 25/27] add alpine apisix-base workflow --- .github/workflows/package-apisix-base-apk.yml | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/package-apisix-base-apk.yml diff --git a/.github/workflows/package-apisix-base-apk.yml b/.github/workflows/package-apisix-base-apk.yml new file mode 100644 index 000000000..86730ac9a --- /dev/null +++ b/.github/workflows/package-apisix-base-apk.yml @@ -0,0 +1,29 @@ +name: package apisix-base rpm for el7 + +on: + push: + branches: [ openresty/* ] + tags: + - "v*" + paths-ignore: + - '*.md' + pull_request: + branches: [ master ] + paths-ignore: + - '*.md' + +jobs: + build: + runs-on: ubuntu-latest + env: + BUILD_APISIX_BASE_VERSION: 1.19.3.2.0 + steps: + - uses: actions/checkout@v2 + + - name: install dependencies + run: | + sudo apt-get install -y make ruby ruby-dev rubygems build-essential + + - name: build apisix-base apk + run: | + make package version=${BUILD_APISIX_BASE_VERSION} image_base=alpine image_tag=3.12 app=apisix-base type=apk From 48880ac6a14a0f81d18241f8483478959154a6c4 Mon Sep 17 00:00:00 2001 From: kv Date: Fri, 15 Oct 2021 12:18:26 +0800 Subject: [PATCH 26/27] modify name --- .github/workflows/package-apisix-base-apk.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/package-apisix-base-apk.yml b/.github/workflows/package-apisix-base-apk.yml index 86730ac9a..6223dd9d7 100644 --- a/.github/workflows/package-apisix-base-apk.yml +++ b/.github/workflows/package-apisix-base-apk.yml @@ -1,4 +1,4 @@ -name: package apisix-base rpm for el7 +name: package apisix-base apk on: push: From 6e004ef1e174131261689d40f13220774035d339 Mon Sep 17 00:00:00 2001 From: spacewander Date: Fri, 15 Oct 2021 15:33:54 +0800 Subject: [PATCH 27/27] try --- dockerfiles/Dockerfile.apisix-base.apk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dockerfiles/Dockerfile.apisix-base.apk b/dockerfiles/Dockerfile.apisix-base.apk index 53b9228e0..ef483709a 100644 --- a/dockerfiles/Dockerfile.apisix-base.apk +++ b/dockerfiles/Dockerfile.apisix-base.apk @@ -54,7 +54,8 @@ RUN cd /tmp \ wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VER}/glibc-${GLIBC_VER}.apk && \ wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VER}/glibc-bin-${GLIBC_VER}.apk && \ wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VER}/glibc-i18n-${GLIBC_VER}.apk && \ - apk add glibc-bin-${GLIBC_VER}.apk glibc-i18n-${GLIBC_VER}.apk glibc-${GLIBC_VER}.apk + apk add glibc-bin-${GLIBC_VER}.apk glibc-i18n-${GLIBC_VER}.apk glibc-${GLIBC_VER}.apk && \ + /usr/glibc-compat/sbin/ldconfig RUN cd /tmp \ && if [ -n "${RESTY_EVAL_PRE_CONFIGURE}" ]; then eval $(echo ${RESTY_EVAL_PRE_CONFIGURE}); fi \