feat(make): 新增 docker-amd64 与 docker-apple 目标构建 x86_64 镜像
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:
parent
832b7c626d
commit
cbb8be7441
16
Makefile
16
Makefile
@ -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:
|
build:
|
||||||
@cd libs && pnpm install --frozen-lockfile
|
@cd libs && pnpm install --frozen-lockfile
|
||||||
@ -156,6 +156,8 @@ doc-open:
|
|||||||
# QEMU is needed. Docker Desktop ships a buildx builder that handles this.
|
# 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 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
|
# make docker-multiarch build amd64+arm64 and push to a registry
|
||||||
# (multi-arch manifests can't be --load-ed locally)
|
# (multi-arch manifests can't be --load-ed locally)
|
||||||
#
|
#
|
||||||
@ -167,6 +169,18 @@ PLATFORMS ?= linux/amd64,linux/arm64
|
|||||||
docker:
|
docker:
|
||||||
@docker buildx build --load -t yggdrasil .
|
@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-multiarch:
|
||||||
@docker buildx build --platform $(PLATFORMS) -t $(IMAGE) --push .
|
@docker buildx build --platform $(PLATFORMS) -t $(IMAGE) --push .
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user