From d0f42d0c57f45f3a346c15a4719091a301302707 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jens=20Heidb=C3=BCchel?= <j.heidbuechel@fz-juelich.de>
Date: Tue, 9 Mar 2021 19:22:19 +0000
Subject: [PATCH] Update .gitlab-ci.yml

---
 .gitlab-ci.yml | 28 +++++++++++++++++++---------
 1 file changed, 19 insertions(+), 9 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 586651d..ff874bb 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,22 +1,32 @@
-stages:
-  - build
+image: docker:19.03.12
 
-image:
-  name: gcr.io/kaniko-project/executor:debug
-  entrypoint: [""]
+variables:
+  DOCKER_TLS_CERTDIR: "/certs"
+  CI_BUILD_ARCHS: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6
+
+services:
+  - docker:19.03.12-dind
+
+before_script:
+  - apk add curl
+  - mkdir -p ~/.docker/cli-plugins/
+  - BUILDX_LATEST_BIN_URI=$(curl -s -L https://github.com/docker/buildx/releases/latest | 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
+  - 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 latex:
   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
+    - docker buildx build --platform $CI_BUILD_ARCHS --progress plain --pull -t $CI_REGISTRY_IMAGE:latest -f Dockerfile --push .
   only:
     - master
 
 Build image without latex:
   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.light --destination $CI_REGISTRY_IMAGE:light
+    - docker buildx build --platform $CI_BUILD_ARCHS --progress plain --pull -t $CI_REGISTRY_IMAGE:light -f Dockerfile.light --push .
   only:
     - master
-- 
GitLab