This repository was archived by the owner on Jul 18, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscripts
More file actions
executable file
·47 lines (39 loc) · 1.38 KB
/
scripts
File metadata and controls
executable file
·47 lines (39 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash -eu
build_ndk_http_module() {
build_module "$1" 'ndk_http_module' 'vision5/ngx_devel_kit'
}
build_set_misc_module() {
build_module "$1" 'ngx_http_set_misc_module' 'openresty/set-misc-nginx-module' 'vision5/ngx_devel_kit'
}
build_module() {
local NGINX_VERSION=${1:-}
local MODULE_NAME=${2:-}
local MODULE_REPO=${3:-}
local GITHUB_REPOS_TO_CLONE=${4:-}
local CONTAINER_NAME=clarakm-nginx-${MODULE_NAME}
local OUT_DIR=./dist
if [[ -z "${NGINX_VERSION}" ]]; then
echo "NGINX version is required as the first argument."
exit 1
elif [[ -z "${MODULE_NAME}" ]]; then
echo "Module name is required as the second argument."
exit 1
elif [[ -z "${MODULE_REPO}" ]]; then
echo "Module repo is required as the third argument."
exit 1
else
docker buildx build \
--platform linux/amd64 \
--build-arg "NGINX_VERSION=${NGINX_VERSION}" \
--build-arg "MODULE_NAME=${MODULE_NAME}" \
--build-arg "MODULE_REPO=${MODULE_REPO}" \
--build-arg "GITHUB_REPOS_TO_CLONE=${GITHUB_REPOS_TO_CLONE}" \
-t ${CONTAINER_NAME}:${NGINX_VERSION} \
.
trap "docker rm -f ${CONTAINER_NAME} >/dev/null 2>&1 || true" 0
docker create --name ${CONTAINER_NAME} ${CONTAINER_NAME}:${NGINX_VERSION}
mkdir -p ${OUT_DIR}
docker cp ${CONTAINER_NAME}:/${MODULE_NAME}.so.tgz ${OUT_DIR}/${MODULE_NAME}_nginx-${NGINX_VERSION}.so.tgz
fi
}
$@