switch docker build to buildx for multiarch

This commit is contained in:
Kai Kriegel 2021-12-13 23:57:14 +00:00
parent 6b88191dc5
commit 2f2d2216af

View File

@ -97,17 +97,29 @@ build:docker-releases:
- docker
build:docker-development:
image:
name: gcr.io/kaniko-project/executor:v1.6.0-debug
entrypoint: [""]
image: docker:20.10.11
services:
- docker:20.10.11-dind
variables:
DOCKER_DRIVER: overlay2
BUILDX_VERSION: "v0.7.1"
BUILDX_ARCH: "linux-amd64"
before_script:
- ''
- echo "$CI_REGISTRY_PASSWORD" | docker login $CI_REGISTRY --username
$CI_REGISTRY_USER --password-stdin
# - wget -O /usr/bin/docker-buildx
# https://github.com/docker/buildx/releases/download/${BUILDX_VERSION}/buildx-${BUILDX_VERSION}.${BUILDX_ARCH}
# - chmod +x /usr/bin/docker-buildx
script:
- mkdir -p /kaniko/.docker
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor --force --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE:dev-latest
only:
- development
- docker-buildx create --use
- docker-buildx build
--platform linux/386,linux/amd64,linux/amd64,linux/arm/v7,linux/arm64/v8
--tag ${CI_REGISTRY_IMAGE}:test
--push
# only:
# - development
tags:
- linux
- docker