Skip to content
Snippets Groups Projects

Resolve "Add multiarch"

Merged Jens Heidbüchel requested to merge 15-add-muliarch into master
Compare and
6 files
+ 37
121
Compare changes
  • Side-by-side
  • Inline
Files
6
+ 22
19
stages:
- build
image: docker
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
variables:
DOCKER_TLS_CERTDIR: "/certs"
CI_BUILD_ARCHS: linux/amd64,linux/arm64
Build image:
stage: build
script:
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE:latest
only:
- master
services:
- docker:dind
before_script:
- apk add curl
- mkdir -p ~/.docker/cli-plugins/
- BUILDX_LATEST_BIN_URI=$(curl -s -L https://github.com/docker/buildx/releases/expanded_assets/v0.9.1 | grep 'linux-amd64' | grep 'href' | sed 's/.*href="/https:\/\/github.com/g; s/amd64".*/amd64/g')
- curl -s -L ${BUILDX_LATEST_BIN_URI} -o ~/.docker/cli-plugins/docker-buildx
- chmod a+x ~/.docker/cli-plugins/docker-buildx
- docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
- echo "$CI_REGISTRY_PASSWORD" | docker login -u "$CI_REGISTRY_USER" --password-stdin $CI_REGISTRY
- docker context create dind
- docker buildx create --driver docker-container --use dind
Build image with ansible 2.9:
Build image:
stage: build
script:
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile-2.9 --destination $CI_REGISTRY_IMAGE:2.9
only:
- docker buildx build --platform $CI_BUILD_ARCHS --progress plain --pull -t $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA -f Dockerfile --push .
except:
- master
Build ubuntu image:
Build latest image:
stage: build
script:
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile.ubuntu --destination $CI_REGISTRY_IMAGE:ubuntu
- docker buildx build --platform $CI_BUILD_ARCHS --progress plain --pull -t $CI_REGISTRY_IMAGE:latest -f Dockerfile --push .
only:
- master
Loading