完善本机构建镜像源配置

This commit is contained in:
WuYongJie 2026-07-21 16:27:52 +08:00
parent 57fcd366f3
commit 2bb53abf80
2 changed files with 10 additions and 1 deletions

2
deploy/buildkitd.toml Normal file
View File

@ -0,0 +1,2 @@
[registry."docker.io"]
mirrors = ["m.daocloud.io/docker.io"]

View File

@ -10,6 +10,7 @@ param(
[string]$RemotePath = '/opt/caiwuxitong', [string]$RemotePath = '/opt/caiwuxitong',
[string]$AppUrl, [string]$AppUrl,
[string]$BuilderName = 'caiwu-builder', [string]$BuilderName = 'caiwu-builder',
[string]$BuildkitImage = 'm.daocloud.io/docker.io/moby/buildkit:buildx-stable-1',
[int]$KeepImages = 2, [int]$KeepImages = 2,
[switch]$BootstrapServer, [switch]$BootstrapServer,
[switch]$AllowNonMain, [switch]$AllowNonMain,
@ -25,6 +26,7 @@ $tempRoot = Join-Path ([IO.Path]::GetTempPath()) ("caiwu-deploy-" + [Guid]::NewG
$localArchive = Join-Path $tempRoot 'image.tar' $localArchive = Join-Path $tempRoot 'image.tar'
$remoteArchive = $null $remoteArchive = $null
$bootstrapRemote = $null $bootstrapRemote = $null
$buildkitConfig = Join-Path $repoRoot 'deploy/buildkitd.toml'
function Invoke-Native { function Invoke-Native {
param( param(
@ -89,7 +91,12 @@ try {
docker buildx inspect $BuilderName 2>$null | Out-Null docker buildx inspect $BuilderName 2>$null | Out-Null
if ($LASTEXITCODE -ne 0) { if ($LASTEXITCODE -ne 0) {
Invoke-Native { Invoke-Native {
docker buildx create --name $BuilderName --driver docker-container --use | Out-Null docker buildx create `
--name $BuilderName `
--driver docker-container `
--driver-opt "image=$BuildkitImage" `
--buildkitd-config $buildkitConfig `
--use | Out-Null
} '创建项目专属 BuildKit 构建器失败。' } '创建项目专属 BuildKit 构建器失败。'
} }