代码拉取完成,页面将自动刷新
#!/usr/bin/env bash
set -Eeuo pipefail
shopt -s nullglob
cd "$(dirname "$(readlink -f "$BASH_SOURCE")")"
declare branches=(
"stable"
"mainline"
)
# Current nginx versions
# Remember to update pkgosschecksum when changing this.
declare -A nginx=(
[mainline]='1.25.5'
[stable]='1.26.0'
)
# Current njs versions
declare -A njs=(
[mainline]='0.8.4'
[stable]='0.8.4'
)
# Current njs patchlevel version
# Remember to update pkgosschecksum when changing this.
declare -A njspkg=(
[mainline]='2'
[stable]='1'
)
# Current otel versions
declare -A otel=(
[mainline]='0.1.0'
[stable]='0.1.0'
)
# Current package patchlevel version
# Remember to update pkgosschecksum when changing this.
declare -A pkg=(
[mainline]=1
[stable]=1
)
declare -A debian=(
[mainline]='bookworm'
[stable]='bookworm'
)
declare -A alpine=(
[mainline]='3.19'
[stable]='3.19'
)
# When we bump njs version in a stable release we don't move the tag in the
# mercurial repo. This setting allows us to specify a revision to check out
# when building alpine packages on architectures not supported by nginx.org
# Remember to update pkgosschecksum when changing this.
declare -A rev=(
[mainline]='93ac6e194ad0'
[stable]='${NGINX_VERSION}-${PKG_RELEASE}'
)
# Holds SHA512 checksum for the pkg-oss tarball produced by source code
# revision/tag in the previous block
# Used in alpine builds for architectures not packaged by nginx.org
declare -A pkgosschecksum=(
[mainline]='d56d10fbc6a1774e0a000b4322c5f847f8dfdcc3035b21cfd2a4a417ecce46939f39ff39ab865689b60cf6486c3da132aa5a88fa56edaad13d90715affe2daf0'
[stable]='f0ee7cef9a6e4aa1923177eb2782577ce61837c22c59bd0c3bd027a0a4dc3a3cdc4a16e95480a075bdee32ae59c0c6385dfadb971f93931fea84976c4a21fceb'
)
get_packages() {
local distro="$1"
shift
local branch="$1"
shift
local bn=""
local otel=
local perl=
local r=
local sep=
case "$distro:$branch" in
alpine*:*)
r="r"
sep="."
;;
debian*:*)
sep="+"
;;
esac
case "$distro" in
*-perl)
perl="nginx-module-perl"
;;
*-otel)
otel="nginx-module-otel"
bn="\n"
;;
esac
echo -n ' \\\n'
case "$distro" in
*-slim)
for p in nginx; do
echo -n ' '"$p"'=${NGINX_VERSION}-'"$r"'${PKG_RELEASE} \\'
done
;;
*)
for p in nginx nginx-module-xslt nginx-module-geoip nginx-module-image-filter $perl; do
echo -n ' '"$p"'=${NGINX_VERSION}-'"$r"'${PKG_RELEASE} \\\n'
done
for p in nginx-module-njs; do
echo -n ' '"$p"'=${NGINX_VERSION}'"$sep"'${NJS_VERSION}-'"$r"'${NJS_RELEASE} \\'"$bn"
done
for p in $otel; do
echo -n ' '"$p"'=${NGINX_VERSION}'"$sep"'${OTEL_VERSION}-'"$r"'${PKG_RELEASE} \\'
done
;;
esac
}
get_packagerepo() {
local distro="$1"
shift
distro="${distro%-perl}"
distro="${distro%-otel}"
distro="${distro%-slim}"
local branch="$1"
shift
[ "$branch" = "mainline" ] && branch="$branch/" || branch=""
echo "https://nginx.org/packages/${branch}${distro}/"
}
get_packagever() {
local distro="$1"
shift
distro="${distro%-perl}"
distro="${distro%-otel}"
distro="${distro%-slim}"
local branch="$1"
shift
local package="$1"
shift
local suffix=
[ "${distro}" = "debian" ] && suffix="~${debianver}"
[ "${package}" = "njs" ] && echo ${njspkg[$branch]}${suffix} || echo ${pkg[$branch]}${suffix}
}
get_buildtarget() {
local distro="$1"
shift
case "$distro" in
alpine-slim)
echo base
;;
alpine-perl)
echo module-perl
;;
alpine-otel)
echo module-otel
;;
alpine)
echo module-geoip module-image-filter module-njs module-xslt
;;
debian)
echo "\$nginxPackages"
;;
debian-perl)
echo "nginx-module-perl=\${NGINX_VERSION}-\${PKG_RELEASE}"
;;
debian-otel)
echo "nginx-module-otel"
;;
esac
}
generated_warning() {
cat <<__EOF__
#
# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh"
#
# PLEASE DO NOT EDIT IT DIRECTLY.
#
__EOF__
}
for branch in "${branches[@]}"; do
for variant in \
alpine{,-perl,-otel,-slim} \
debian{,-perl,-otel}; do
echo "$branch: $variant dockerfiles"
dir="$branch/$variant"
variant="$(basename "$variant")"
[ -d "$dir" ] || continue
template="Dockerfile-${variant}.template"
{
generated_warning
cat "$template"
} >"$dir/Dockerfile"
debianver="${debian[$branch]}"
alpinever="${alpine[$branch]}"
nginxver="${nginx[$branch]}"
njsver="${njs[${branch}]}"
otelver="${otel[${branch}]}"
revver="${rev[${branch}]}"
pkgosschecksumver="${pkgosschecksum[${branch}]}"
packagerepo=$(get_packagerepo "$variant" "$branch")
packages=$(get_packages "$variant" "$branch")
packagever=$(get_packagever "$variant" "$branch" "any")
njspkgver=$(get_packagever "$variant" "$branch" "njs")
buildtarget=$(get_buildtarget "$variant")
sed -i.bak \
-e 's,%%ALPINE_VERSION%%,'"$alpinever"',' \
-e 's,%%DEBIAN_VERSION%%,'"$debianver"',' \
-e 's,%%NGINX_VERSION%%,'"$nginxver"',' \
-e 's,%%NJS_VERSION%%,'"$njsver"',' \
-e 's,%%NJS_RELEASE%%,'"$njspkgver"',' \
-e 's,%%OTEL_VERSION%%,'"$otelver"',' \
-e 's,%%PKG_RELEASE%%,'"$packagever"',' \
-e 's,%%PACKAGES%%,'"$packages"',' \
-e 's,%%PACKAGEREPO%%,'"$packagerepo"',' \
-e 's,%%REVISION%%,'"$revver"',' \
-e 's,%%PKGOSSCHECKSUM%%,'"$pkgosschecksumver"',' \
-e 's,%%BUILDTARGET%%,'"$buildtarget"',' \
"$dir/Dockerfile"
done
for variant in \
alpine-slim \
debian; do \
echo "$branch: $variant entrypoint scripts"
dir="$branch/$variant"
cp -a entrypoint/*.sh "$dir/"
cp -a entrypoint/*.envsh "$dir/"
done
done
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。