arm64/amd64 builds of genuinetools/img
Find a file
2021-10-11 22:38:24 +02:00
.gitlab-ci.yml Initial commit 2021-10-11 22:38:24 +02:00
README.md Initial commit 2021-10-11 22:38:24 +02:00

img

This is an arm64/amd64 build of https://github.com/genuinetools/img. It can be used to build Docker images using GitLab CI without executing a runner in privileged mode. In contrast to kaniko it supports building multi-arch images out of the box.

To set it up, however, you need to add security_opt = ["seccomp:unconfined", "apparmor:unconfined"] below [runners.docker] in the runners config.toml. For using the RUN directive in Dockerfiles on non-native architectures, you need emulation, e. g. provided by QEMU. If your host system is Debian, you can simply install qemu-user-static.

Finally, you can use a .gitlab-ci.yml like this:

build-docker:
  stage: build
  image:
    name: registry.husung.dev/nils/img-builder:latest
    entrypoint: [""]
  before_script:
    - img login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY"
  script:
    - img build -t "$CI_REGISTRY_IMAGE:latest" --platform linux/arm64 --platform linux/amd64 "$CI_PROJECT_DIR"
    - img push "$CI_REGISTRY_IMAGE:latest"