chore(devcontainer): use official nginx packages

This commit is contained in:
0xJacky
2026-05-13 08:38:11 +08:00
parent 0f0fa1c083
commit f40fe5a86d
2 changed files with 28 additions and 9 deletions
+12 -4
View File
@@ -2,10 +2,17 @@ FROM mcr.microsoft.com/devcontainers/base:noble
# Combine installation steps for Nginx and Go to avoid repetitive update/cleanup commands
RUN apt-get update && \
apt-get install -y --no-install-recommends curl ca-certificates jq cloc && \
apt-get install -y --no-install-recommends curl ca-certificates jq cloc gnupg2 lsb-release ubuntu-keyring && \
\
# Install Nginx packages from the base system repository
apt-get install -y --no-install-recommends nginx nginx-extras inotify-tools file && \
# Install Nginx packages from the official nginx.org repository
curl -fsSL https://nginx.org/keys/nginx_signing.key | \
gpg --dearmor -o /usr/share/keyrings/nginx-archive-keyring.gpg && \
echo "deb [signed-by=/usr/share/keyrings/nginx-archive-keyring.gpg] https://nginx.org/packages/ubuntu $(lsb_release -cs) nginx" > \
/etc/apt/sources.list.d/nginx.list && \
printf "Package: *\nPin: origin nginx.org\nPin: release o=nginx\nPin-Priority: 900\n" > \
/etc/apt/preferences.d/99nginx && \
apt-get update && \
apt-get install -y --no-install-recommends nginx inotify-tools file && \
\
# Automatically retrieve the latest stable Go version and install it,
# download the appropriate binary based on system architecture (amd64 or arm64)
@@ -21,7 +28,8 @@ RUN apt-get update && \
curl -sSL "https://golang.org/dl/go${GO_VERSION}.${GO_ARCH}.tar.gz" -o go.tar.gz && \
rm -rf /usr/local/go && \
tar -C /usr/local -xzf go.tar.gz && \
rm go.tar.gz
rm go.tar.gz && \
rm -rf /var/lib/apt/lists/*
RUN cp -rp /etc/nginx /etc/nginx.orig
+13 -2
View File
@@ -17,10 +17,17 @@ create_symlink() {
local target="$dest_dir/$weight-$module_name"
local source="$src_dir/$module_name"
if [ ! -f "$source" ]; then
echo "Skipped missing module config: $source"
return
fi
ln -sf "$source" "$target"
echo "Created symlink: $target -> $source"
}
mkdir -p "$dest_dir"
modules=(
"mod-http-ndk.conf 10"
"mod-http-auth-pam.conf 50"
@@ -45,12 +52,16 @@ modules=(
"mod-stream-geoip2.conf 70"
)
for module in "${modules[@]}"; do
if [ -d "$src_dir" ]; then
for module in "${modules[@]}"; do
module_name=$(echo $module | awk '{print $1}')
weight=$(echo $module | awk '{print $2}')
create_symlink "$module_name" "$weight"
done
done
else
echo "Skipped module symlink creation because $src_dir does not exist"
fi
# start nginx
nginx