尝试docker buildx
与 GitLabs 共享运行器一起使用来构建可以在我的 Raspberry Pi 上运行的 Docker 映像。作业失败,说 git 不在 PATH 中,但 git 安装在image: docker:stable-git
. 是否有任何已知的修复程序或更好的方法来构建与 ARM64 兼容的映像,而无需在 Raspberry Pi 本身上构建?(由于 CPU 使用率,RPi 在构建时变得不可用)
deploy:
image: docker:stable-git
stage: deploy
services:
- docker:dind
before_script:
- export DOCKER_BUILDKIT=1
- export DOCKER_CLI_EXPERIMENTAL=enabled
- docker build --platform=local -o . git://github.com/docker/buildx
- mv buildx ~/.docker/cli-plugins/docker-buildx
script:
- docker buildx build --platform linux/amd64,linux/arm64 -t $CI_REGISTRY_IMAGE .
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker push $CI_REGISTRY_IMAGE
$ export DOCKER_BUILDKIT=1
$ export DOCKER_CLI_EXPERIMENTAL=enabled
$ docker build --platform=local -o . git://github.com/docker/buildx
#1 [internal] load git source git://github.com/docker/buildx
#1 ERROR: failed to init repo at /var/lib/docker/overlay2/xxx/diff: exec: "git": executable file not found in $PATH
------
> [internal] load git source git://github.com/docker/buildx:
------
failed to solve with frontend dockerfile.v0: failed to resolve dockerfile: failed to build LLB: failed to load cache key: failed to init repo at /var/lib/docker/overlay2/xxx/diff: exec: "git": executable file not found in $PATH
ERROR: Job failed: exit code 1