Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: make apisix-base start on Alpine #248

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 24 additions & 10 deletions build-apisix-base.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ else
OR_PREFIX=${OR_PREFIX:="/usr/local/openresty"}
fi

use_musl=
if echo "int main(void) {}" | gcc -o /dev/null -v -x c - &> /dev/stdout| grep collect | tr -s " " "\012" | grep musl; then
# shared library compiled by cgo can't be loaded via dlopen with musl
# https://github.com/golang/go/issues/54805
use_musl=true
fi

prev_workdir="$PWD"
repo=$(basename "$prev_workdir")
workdir=$(mktemp -d)
Expand Down Expand Up @@ -73,12 +80,17 @@ else
lua-var-nginx-module-${lua_var_nginx_module_ver}
fi

if [ "$repo" == grpc-client-nginx-module ]; then
cp -r "$prev_workdir" ./grpc-client-nginx-module-${grpc_client_nginx_module_ver}
else
git clone --depth=1 -b $grpc_client_nginx_module_ver \
https://github.com/api7/grpc-client-nginx-module \
grpc-client-nginx-module-${grpc_client_nginx_module_ver}
add_grpc_client_nginx_module=
if [ -z "$use_musl" ]; then
if [ "$repo" == grpc-client-nginx-module ]; then
cp -r "$prev_workdir" ./grpc-client-nginx-module-${grpc_client_nginx_module_ver}
else
git clone --depth=1 -b $grpc_client_nginx_module_ver \
https://github.com/api7/grpc-client-nginx-module \
grpc-client-nginx-module-${grpc_client_nginx_module_ver}

add_grpc_client_nginx_module="--add-module=../grpc-client-nginx-module-${grpc_client_nginx_module_ver}"
fi
fi

cd ngx_multi_upstream_module-${ngx_multi_upstream_module_ver} || exit 1
Expand Down Expand Up @@ -110,7 +122,7 @@ cd openresty-${or_ver} || exit 1
--add-module=../apisix-nginx-module-${apisix_nginx_module_ver}/src/meta \
--add-module=../wasm-nginx-module-${wasm_nginx_module_ver} \
--add-module=../lua-var-nginx-module-${lua_var_nginx_module_ver} \
--add-module=../grpc-client-nginx-module-${grpc_client_nginx_module_ver} \
$add_grpc_client_nginx_module \
--with-poll_module \
--with-pcre-jit \
--without-http_rds_json_module \
Expand Down Expand Up @@ -153,6 +165,8 @@ cd wasm-nginx-module-${wasm_nginx_module_ver} || exit 1
sudo OPENRESTY_PREFIX="$OR_PREFIX" make install
cd ..

cd grpc-client-nginx-module-${grpc_client_nginx_module_ver} || exit 1
sudo OPENRESTY_PREFIX="$OR_PREFIX" make install
cd ..
if [ -z "$use_musl" ]; then
cd grpc-client-nginx-module-${grpc_client_nginx_module_ver} || exit 1
sudo OPENRESTY_PREFIX="$OR_PREFIX" make install
cd ..
fi