Hello,
I built a arm64 image using docker + buildx.
I store every images in gitlab registry and i’m using shared runners.
Dockerfile:
# syntax=docker/dockerfile:1
FROM docker:20.10.7-dind
LABEL description="Container that contain buildx for building arm64 images"
ARG BUILDX_VERSION="v0.5.1"
RUN mkdir -p ~/.docker/cli-plugins
RUN set -eux; \
wget -q -O ~/.docker/cli-plugins/docker-buildx https://github.com/docker/buildx/releases/download/$BUILDX_VERSION/buildx-${BUILDX_VERSION}.linux-amd64 && \
chmod +x ~/.docker/cli-plugins/docker-buildx
And then in gitlab-ci:
build-image-dind-buildx:
stage: build-image-dind-buildx
services:
- docker:dind
variables:
DOCKER_TLS_CERTDIR: "/certs"
CONTAINER_BUILD_IMAGE: $CI_REGISTRY_IMAGE/$DIND_BUILDX_REGISTRY_NAME
script:
- echo "$CI_REGISTRY_PASSWORD" | docker login -u "$CI_REGISTRY_USER" --password-stdin $CI_REGISTRY
- docker build --pull --cache-from $CONTAINER_BUILD_IMAGE -t $CONTAINER_BUILD_IMAGE -f ./docker/dind-buildx/Dockerfile .
- docker push $CONTAINER_BUILD_IMAGE
dependencies: []
cache: {}
when: manual
After that I use that image to build an arm64 image that contains gcc, cmake and some libs that I need:
build-image-dev-env:gcc-arm64:
stage: build-image-dev-env
image: $CI_REGISTRY_IMAGE/$DIND_BUILDX_REGISTRY_NAME
services:
- docker:dind
variables:
DOCKER_TLS_CERTDIR: "/certs"
CONTAINER_ENVIRONMENT_IMAGE: $CI_REGISTRY_IMAGE/$DEV_ENV_REGISTRY_NAME:gcc-11-arm
before_script:
- docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
script:
- echo "$CI_REGISTRY_PASSWORD" | docker login -u "$CI_REGISTRY_USER" --password-stdin $CI_REGISTRY
- docker buildx build --pull --platform linux/arm64 --build-arg CMAKE_ARCH=linux-aarch64 --cache-from $CONTAINER_ENVIRONMENT_IMAGE -t $CONTAINER_ENVIRONMENT_IMAGE -f ./docker/build_environment/linux/gcc/Dockerfile .
- docker push $CONTAINER_ENVIRONMENT_IMAGE
dependencies: []
cache: {}
when: manual
Now with this image I’d like to build my code using cmake:
build-cleanjk:gcc-arm:
stage: build
image: $CI_REGISTRY_IMAGE/$DEV_ENV_REGISTRY_NAME:gcc-11-arm
before_script:
- mkdir -p ccache
- export CCACHE_DIR=$(pwd)/ccache
script:
- ccache --version
- docker --version
#- mkdir -p build && cd build
#- cmake ..
#- make
<<: *artifacts-linux
<<: *cache-gcc-arm
dependencies: []
interruptible: true
when: manual
But when I do that, I have this error:
standard_init_linux.go:190: exec user process caused "no such file or directory"
So I was wondering if there’s a arm64 shared runner available on gitlab SaaS or if I have to host my own runner if I want to compiles arm64 code ?
Thank you for your time !