feat(iso): add APT_PROXY support to speed up builds via apt-cacher-ng

Pass APT_PROXY=http://host:3142 to build-in-container.sh to route
all apt traffic through a local cache. Also supports --apt-proxy flag.
Mirrors in auto/config are set from BEE_APT_PROXY env when present.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-28 09:57:54 +03:00
parent c6fbfc8306
commit de130966f7
2 changed files with 19 additions and 4 deletions

View File

@@ -9,6 +9,7 @@ CONTAINER_TOOL="${CONTAINER_TOOL:-docker}"
IMAGE_TAG="${BEE_BUILDER_IMAGE:-bee-iso-builder}"
BUILDER_PLATFORM="${BEE_BUILDER_PLATFORM:-linux/amd64}"
CACHE_DIR="${BEE_BUILDER_CACHE_DIR:-${REPO_ROOT}/dist/container-cache}"
APT_PROXY="${APT_PROXY:-}"
AUTH_KEYS=""
REBUILD_IMAGE=0
@@ -28,9 +29,13 @@ while [ $# -gt 0 ]; do
AUTH_KEYS="$2"
shift 2
;;
--apt-proxy)
APT_PROXY="$2"
shift 2
;;
*)
echo "unknown arg: $1" >&2
echo "usage: $0 [--cache-dir /path] [--rebuild-image] [--authorized-keys /path/to/authorized_keys]" >&2
echo "usage: $0 [--cache-dir /path] [--rebuild-image] [--authorized-keys /path/to/authorized_keys] [--apt-proxy http://host:3142]" >&2
exit 1
;;
esac
@@ -100,6 +105,7 @@ set -- \
-e GOMODCACHE=/cache/go-mod \
-e TMPDIR=/cache/tmp \
-e BEE_CACHE_DIR=/cache/bee \
${APT_PROXY:+-e BEE_APT_PROXY="${APT_PROXY}"} \
-w /work \
"${IMAGE_REF}" \
sh /work/iso/builder/build.sh
@@ -115,6 +121,7 @@ if [ -n "$AUTH_KEYS" ]; then
-e GOMODCACHE=/cache/go-mod \
-e TMPDIR=/cache/tmp \
-e BEE_CACHE_DIR=/cache/bee \
${APT_PROXY:+-e BEE_APT_PROXY="${APT_PROXY}"} \
-w /work \
"${IMAGE_REF}" \
sh /work/iso/builder/build.sh --authorized-keys "/tmp/bee-authkeys/${AUTH_KEYS_BASE}"