1.创建builder配置文件
buildkitd.toml
debug = true
[registry."docker.io"]
#mirrors = ["hub.dvcloud.xin"]
http = true
insecure = true
2.定义需要构建的平台
platform="linux/amd64,linux/arm64"
3.创建builder
if ! docker buildx ls |grep xadmin-builder &>/dev/null;then
docker buildx create --platform "${platform}" --name xadmin-builder --driver docker-container --buildkitd-config buildkitd.toml --bootstrap --use
fi
4.启用构建,并推送到仓库
在Dockerfile目录下,执行构建命令
docker buildx use xadmin-builder
docker buildx build -t nineaiyu/xadmin-server:4.1.5 --platform "${platform}" --push --provenance=false .