Trying to use docker buildx
with GitLabs shared runners to build a Docker image that can be run on my Raspberry Pi. Job fails saying git is not in PATH but git is installed in image: docker:stable-git
. Any known fixes or a better way to build an ARM64-compatible image without having to build on the Raspberry Pi itself? (RPi becomes unusable while building on it due to CPU usage)
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