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:
@@ -16,6 +16,14 @@ else
|
||||
LB_LINUX_PACKAGES="linux-image"
|
||||
fi
|
||||
|
||||
# Route apt through proxy if BEE_APT_PROXY is set (e.g. apt-cacher-ng).
|
||||
# Usage: APT_PROXY=http://host:3142 ./build-in-container.sh
|
||||
if [ -n "${BEE_APT_PROXY:-}" ]; then
|
||||
_MIRROR="${BEE_APT_PROXY%/}/debian"
|
||||
else
|
||||
_MIRROR="https://deb.debian.org/debian"
|
||||
fi
|
||||
|
||||
lb config noauto \
|
||||
--distribution bookworm \
|
||||
--architectures amd64 \
|
||||
@@ -23,9 +31,9 @@ lb config noauto \
|
||||
--bootloaders "grub-efi,syslinux" \
|
||||
--debian-installer none \
|
||||
--archive-areas "main contrib non-free non-free-firmware" \
|
||||
--mirror-bootstrap "https://deb.debian.org/debian" \
|
||||
--mirror-chroot "https://deb.debian.org/debian" \
|
||||
--mirror-binary "https://deb.debian.org/debian" \
|
||||
--mirror-bootstrap "${_MIRROR}" \
|
||||
--mirror-chroot "${_MIRROR}" \
|
||||
--mirror-binary "${_MIRROR}" \
|
||||
--security true \
|
||||
--linux-flavours "amd64" \
|
||||
--linux-packages "${LB_LINUX_PACKAGES}" \
|
||||
|
||||
@@ -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}"
|
||||
|
||||
Reference in New Issue
Block a user