feat(make): 新增 docker-amd64 与 docker-apple 目标构建 x86_64 镜像
Some checks failed
CI / check (push) Has been cancelled
CI / build (push) Has been cancelled

docker target 只出当前宿主架构(Apple Silicon 上为 arm64),无法直接得到
x86 镜像;docker-multiarch 虽支持 amd64 但强制 --push 到 registry,无法本地
验证。补两个本地可用的 x86_64 构建 target:

- docker-amd64:docker buildx --platform linux/amd64 --load,走 QEMU 交叉仿真,
  产物进 Docker 本地 daemon,可直接 docker run / docker save。
- docker-apple:Apple Container CLI(macos 26 Tahoe)原生构建,无需 Docker Desktop,
  用 --arch(非 --platform)。

Dockerfile 本身按 dpkg --print-architecture 自适应选 musl target,无需修改。
This commit is contained in:
xfy 2026-07-15 17:36:57 +08:00
parent 832b7c626d
commit cbb8be7441

View File

@ -1,4 +1,4 @@
.PHONY: dev build build-linux build-freebsd freebsd-sysroot docker css css-watch clean build-libs build-editor build-codemirror build-lightbox build-core highlight-css test doc doc-open start lint fix restore-webp
.PHONY: dev build build-linux build-freebsd freebsd-sysroot docker docker-amd64 docker-apple docker-multiarch css css-watch clean build-libs build-editor build-codemirror build-lightbox build-core highlight-css test doc doc-open start lint fix restore-webp
build:
@cd libs && pnpm install --frozen-lockfile
@ -156,6 +156,8 @@ doc-open:
# QEMU is needed. Docker Desktop ships a buildx builder that handles this.
#
# make docker native arch only, load into local daemon (for testing)
# make docker-amd64 x86_64 only, load into local daemon (buildx + QEMU on Apple Silicon)
# make docker-apple x86_64 only, via Apple Container CLI (macOS 26+, Apple Silicon native; no Docker needed)
# make docker-multiarch build amd64+arm64 and push to a registry
# (multi-arch manifests can't be --load-ed locally)
#
@ -167,6 +169,18 @@ PLATFORMS ?= linux/amd64,linux/arm64
docker:
@docker buildx build --load -t yggdrasil .
# Cross-build x86_64 into the local daemon. buildx 仿真非原生架构,无需修改 Dockerfile
# (它本就按 dpkg --print-architecture 自适应选 musl target)。Apple Silicon 上走 QEMU,
# 比 native 慢;产物可直接 docker run / docker save 导出。
docker-amd64:
@docker buildx build --platform linux/amd64 --load -t yggdrasil:amd64 .
# Apple Container CLI 构建 x86_64 镜像。前提:macOS 26 Tahoe + 已安装 `container`。
# 无需 Docker Desktop;使用 --arch 而非 --platform(Apple Container 用裸架构名,OS 固定 linux)。
# 产出标准 OCI 镜像,可 container push 到 registry 后在 Linux 上用 docker compose 运行。
docker-apple:
@container build --arch amd64 -t yggdrasil:amd64 .
docker-multiarch:
@docker buildx build --platform $(PLATFORMS) -t $(IMAGE) --push .