2026-10-09 16:41:13 +08:00

27 lines
909 B
Bash
Executable File

#!/bin/bash
# bos_fetch 镜像构建 (小镜像, 独立 context)
set -euo pipefail
cd "$(dirname "$0")"
PROXY="${http_proxy:-${https_proxy:-http://192.168.16.68:18000}}"
BUILDER="proxybuilder"
if ! docker buildx inspect "$BUILDER" >/dev/null 2>&1; then
docker buildx create --name "$BUILDER" --driver docker-container \
--driver-opt "env.http_proxy=$PROXY" \
--driver-opt "env.https_proxy=$PROXY" \
--driver-opt "env.HTTP_PROXY=$PROXY" \
--driver-opt "env.HTTPS_PROXY=$PROXY" \
--driver-opt "env.no_proxy=localhost"
fi
STAMP="$(date +%Y%m%d_%H%M%S)"
REG="ccr-29eug8s3-pub.cnc.bj.baidubce.com/public"
image="$REG/openpi_bos_fetch:v$STAMP"
docker buildx build --builder "$BUILDER" --load \
--build-arg http_proxy="$PROXY" \
--build-arg https_proxy="$PROXY" \
--build-arg no_proxy="localhost" \
-f Dockerfile -t "$image" .
echo "[build] built: $image"
echo "$image" > .last_image