I’m actually trying to build docker images on gitlab-ci and I’d like to build multi arch docker images.
That for, I’m using the following gitlab-ci.yml :
stages:
- build
build_amd64:
image: docker:stable
stage: build
services:
- docker:dind
variables:
DOCKER_DRIVER: overlay2
script:
- docker build --build-arg IMAGE_ARCH=amd64 -t amd64/multiarch-ci:$CI_COMMIT_SHA .
build_arm64v8:
image: docker:stable
stage: build
services:
- docker:dind
variables:
DOCKER_DRIVER: overlay2
before_script:
- docker run --rm --privileged multiarch/qemu-user-static:register --reset
script:
- docker build --build-arg IMAGE_ARCH=arm64v8 -t arm64v8/multiarch-ci:$CI_COMMIT_SHA
My project is a dummy node project with just a console log. For the amd64 build. Everything goes fine.
For the arm build, I get the following error
Status: Downloaded newer image for arm64v8/node:latest
---> b7d3ee2eb758
Step 3/7 : ENV PORT 80
---> Running in 34b155b682b9
Removing intermediate container 34b155b682b9
---> a0fbafb8698b
Step 4/7 : COPY . /code
---> 258e18cc5a7c
Step 5/7 : WORKDIR /code
---> Running in 8f4de48ee080
Removing intermediate container 8f4de48ee080
---> 2167dc4d8bea
Step 6/7 : RUN /usr/local/bin/npm install
---> Running in 1d5d97046cd9
standard_init_linux.go:207: exec user process caused "no such file or directory"
The command '/bin/sh -c /usr/local/bin/npm install' returned a non-zero code: 1
ERROR: Job failed: exit code 1
Did anyone try to do that ?
Here is a public repo I made for that https://gitlab.com/jeremie.drouet/multiarch-ci