53 lines
2.1 KiB
Docker
53 lines
2.1 KiB
Docker
ARG BASE_IMAGE=mirror.gcr.io/library/debian:bookworm-slim
|
|
FROM ${BASE_IMAGE}
|
|
ARG SINGBOX_VERSION=1.12.13
|
|
ARG APT_MIRROR=http://mirror.yandex.ru/debian
|
|
ARG APT_SECURITY_MIRROR=http://mirror.yandex.ru/debian-security
|
|
ARG HTTP_PROXY
|
|
ARG HTTPS_PROXY
|
|
ARG NO_PROXY
|
|
ARG http_proxy
|
|
ARG https_proxy
|
|
ARG no_proxy
|
|
|
|
RUN export http_proxy="${http_proxy:-${HTTP_PROXY:-}}" \
|
|
&& export https_proxy="${https_proxy:-${HTTPS_PROXY:-}}" \
|
|
&& export no_proxy="${no_proxy:-${NO_PROXY:-}}" \
|
|
&& for file in /etc/apt/sources.list /etc/apt/sources.list.d/*.sources; do \
|
|
[ -f "$file" ] || continue; \
|
|
sed -i \
|
|
-e "s|http://deb.debian.org/debian-security|${APT_SECURITY_MIRROR}|g" \
|
|
-e "s|http://security.debian.org/debian-security|${APT_SECURITY_MIRROR}|g" \
|
|
-e "s|http://deb.debian.org/debian|${APT_MIRROR}|g" \
|
|
"$file"; \
|
|
done \
|
|
&& apt-get \
|
|
-o Acquire::Retries=3 \
|
|
-o Acquire::http::Timeout=20 \
|
|
-o Acquire::https::Timeout=20 \
|
|
-o Acquire::ForceIPv4=true \
|
|
update \
|
|
&& apt-get \
|
|
-o Acquire::Retries=3 \
|
|
-o Acquire::http::Timeout=20 \
|
|
-o Acquire::https::Timeout=20 \
|
|
-o Acquire::ForceIPv4=true \
|
|
install -y --no-install-recommends ca-certificates curl iptables ipset iproute2 nodejs npm dumb-init \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
RUN set -eux; \
|
|
export http_proxy="${http_proxy:-${HTTP_PROXY:-}}"; \
|
|
export https_proxy="${https_proxy:-${HTTPS_PROXY:-}}"; \
|
|
export no_proxy="${no_proxy:-${NO_PROXY:-}}"; \
|
|
arch="$(dpkg --print-architecture)"; \
|
|
case "$arch" in \
|
|
amd64) sb_arch="amd64" ;; \
|
|
arm64) sb_arch="arm64" ;; \
|
|
*) echo "Unsupported architecture: $arch" >&2; exit 1 ;; \
|
|
esac; \
|
|
curl -fsSL "https://github.com/SagerNet/sing-box/releases/download/v${SINGBOX_VERSION}/sing-box-${SINGBOX_VERSION}-linux-${sb_arch}.tar.gz" -o /tmp/sing-box.tgz; \
|
|
tar -xzf /tmp/sing-box.tgz -C /tmp; \
|
|
mv "/tmp/sing-box-${SINGBOX_VERSION}-linux-${sb_arch}/sing-box" /usr/local/bin/sing-box; \
|
|
chmod +x /usr/local/bin/sing-box; \
|
|
rm -rf /tmp/sing-box*
|