feat(sandbox): add a graphical desktop to session sandboxes (#3245)

This commit is contained in:
nullptr-error
2026-09-14 20:37:37 +08:00
committed by GitHub
parent 98e216841c
commit 6ccc5cedf1
79 changed files with 7277 additions and 203 deletions
+43 -1
View File
@@ -220,6 +220,7 @@ build_sandbox_image() {
# 而 Docker 后端只在本地缺失时才去拉,本地不打这个标签就等于白构建。
docker build \
--platform $PLATFORM \
--build-arg TARGETPLATFORM=$PLATFORM \
-f docker/Dockerfile.sandbox \
--target sandbox \
-t wechatopenai/weknora-sandbox:latest \
@@ -238,17 +239,54 @@ build_sandbox_image() {
docker build \
--platform linux/amd64 \
--build-arg TARGETPLATFORM=linux/amd64 \
--build-arg TARGETARCH=amd64 \
-f docker/Dockerfile.sandbox \
--target cube \
-t wechatopenai/weknora-sandbox:latest-cube \
-t wechatopenai/weknora-sandbox:main-cube \
.
if [ $? -ne 0 ]; then
log_error "沙箱镜像 Cube 变体构建失败"
return 1
fi
# Desktop variant: XFCE + x11vnc + websockify. Tagged for E2B template
# builds; the Docker backend does not consume this image yet.
log_info "构建沙箱镜像桌面变体 (weknora-sandbox:main-desktop)..."
docker build \
--platform $PLATFORM \
--build-arg TARGETPLATFORM=$PLATFORM \
-f docker/Dockerfile.sandbox \
--target desktop \
-t wechatopenai/weknora-sandbox:latest-desktop \
-t wechatopenai/weknora-sandbox:main-desktop \
.
if [ $? -ne 0 ]; then
log_error "沙箱镜像桌面变体构建失败"
return 1
fi
log_info "构建沙箱镜像桌面 Cube 变体 (weknora-sandbox:main-desktop-cube)..."
docker build \
--platform linux/amd64 \
--build-arg TARGETPLATFORM=linux/amd64 \
--build-arg TARGETARCH=amd64 \
-f docker/Dockerfile.sandbox \
--target desktop-cube \
-t wechatopenai/weknora-sandbox:latest-desktop-cube \
-t wechatopenai/weknora-sandbox:main-desktop-cube \
.
if [ $? -eq 0 ]; then
log_success "沙箱镜像构建成功"
return 0
else
log_error "沙箱镜像 Cube 变体构建失败"
log_error "沙箱镜像桌面 Cube 变体构建失败"
return 1
fi
}
@@ -337,8 +375,12 @@ clean_images() {
docker rmi wechatopenai/weknora-ui:latest 2>/dev/null || true
docker rmi wechatopenai/weknora-sandbox:latest 2>/dev/null || true
docker rmi wechatopenai/weknora-sandbox:latest-cube 2>/dev/null || true
docker rmi wechatopenai/weknora-sandbox:latest-desktop 2>/dev/null || true
docker rmi wechatopenai/weknora-sandbox:latest-desktop-cube 2>/dev/null || true
docker rmi wechatopenai/weknora-sandbox:main 2>/dev/null || true
docker rmi wechatopenai/weknora-sandbox:main-cube 2>/dev/null || true
docker rmi wechatopenai/weknora-sandbox:main-desktop 2>/dev/null || true
docker rmi wechatopenai/weknora-sandbox:main-desktop-cube 2>/dev/null || true
docker image prune -f