43 lines
1.9 KiB
Bash
Executable File
43 lines
1.9 KiB
Bash
Executable File
#!/bin/bash
|
|
# 幂等构建编排 (train 镜像)。
|
|
# 用法: ./build_docker.sh (无需参数)
|
|
set -euo pipefail
|
|
cd "$(dirname "$0")"
|
|
|
|
# 1) XPolicyLab 就位 (serve 前端要 import 其 client_server/ws 服务端协议实现)
|
|
DEST="src-externals/XPolicyLab"
|
|
if [ ! -d "$DEST/client_server" ]; then
|
|
mkdir -p "$DEST"
|
|
echo "[build] copying ../reference/XPolicyLab -> $DEST"
|
|
(cd "../reference/XPolicyLab" && tar cf - --exclude='.git' .) | (cd "$DEST" && tar xf -)
|
|
fi
|
|
|
|
# 2) 官方权重幂等预取 (Dockerfile 只 COPY, 镜像内不下载)
|
|
PROXY="${http_proxy:-${https_proxy:-http://192.168.16.68:18000}}"
|
|
export http_proxy="$PROXY" https_proxy="$PROXY"
|
|
bash scripts/fetch_weights.sh
|
|
|
|
# 3) buildx builder: 默认 docker driver (宿主 daemon 的 systemd 代理 + registry 凭证,
|
|
# 拉取/推送都可靠)。容器型 builder 的 registry 请求不走 env 代理且创建时固化的
|
|
# 代理地址会过期, 不要用 (2026-09-08 实测, 详见 releases/RELEASES.md)。
|
|
PROXY="${http_proxy:-${https_proxy:-http://192.168.16.68:18000}}"
|
|
export http_proxy="$PROXY" https_proxy="$PROXY"
|
|
|
|
# 4) tag = openpi 副本 git 短hash-日期 (镜像身份自带代码可追溯, 对齐平台官方算子规范);
|
|
# 同日多次构建手动加 -N 后缀区分。tag 同时落 ~/tmp_daa_reg/cur_tag 供
|
|
# update_ops.py (算子联动) 与 platform_run.py (IMG_TRAIN) 读取。
|
|
GIT_HASH="$(git -C openpi rev-parse --short HEAD)"
|
|
STAMP="$(date +%Y%m%d)"
|
|
REG="ccr-29eug8s3-pub.cnc.bj.baidubce.com/public"
|
|
|
|
image="$REG/openpi_train_inference:${GIT_HASH}-${STAMP}"
|
|
mkdir -p "$HOME/tmp_daa_reg"
|
|
echo -n "$image" > "$HOME/tmp_daa_reg/cur_tag"
|
|
# --push 直推 registry, 不 --load 落本地 (省一半磁盘)
|
|
docker buildx build --builder default --push \
|
|
--build-arg http_proxy="$PROXY" \
|
|
--build-arg https_proxy="$PROXY" \
|
|
--build-arg no_proxy="localhost" \
|
|
-f Dockerfile -t "$image" .
|
|
echo "[build] pushed: $image"
|