From a47ecd9e02bc3a18461c57073b995151d2d86a93 Mon Sep 17 00:00:00 2001
From: Thomas Schneider <thomas@fsmpi.rwth-aachen.de>
Date: Tue, 24 Sep 2019 11:52:36 +0200
Subject: [PATCH] Use kaniko to build the images

---
 .gitlab-ci.yml | 31 +++++--------------------------
 1 file changed, 5 insertions(+), 26 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 0b585a3..3802925 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,23 +1,6 @@
-image: docker:stable
-
-variables:
-  # When using dind service we need to instruct docker, to talk with the
-  # daemon started inside of the service. The daemon is available with
-  # a network connection instead of the default /var/run/docker.sock socket.
-  #
-  # The 'docker' hostname is the alias of the service container as described at
-  # https://docs.gitlab.com/ee/ci/docker/using_docker_images.html#accessing-the-services
-  #
-  # Note that if you're using Kubernetes executor, the variable should be set to
-  # tcp://localhost:2375 because of how Kubernetes executor connects services
-  # to the job container
-  DOCKER_HOST: tcp://docker:2375/
-  # When using dind, it's wise to use the overlayfs driver for
-  # improved performance.
-  DOCKER_DRIVER: overlay2
-
-services:
-  - docker:dind
+image:
+  name: gcr.io/kaniko-project/executor:debug
+  entrypoint: [""]
 
 stages:
   - base
@@ -25,16 +8,12 @@ stages:
   - second
 
 before_script:
-  - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
-  - docker info
+  - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
 
 .build:
   tags:
-    - dind
   script:
-    - docker build --no-cache=true --build-arg DEBIAN_RELEASE=$DEBIAN_RELEASE --tag $CI_REGISTRY_IMAGE/$IMAGE_NAME:$DEBIAN_RELEASE-$CI_COMMIT_SHA --tag $CI_REGISTRY_IMAGE/$IMAGE_NAME:$DEBIAN_RELEASE $IMAGE_NAME
-    - docker push $CI_REGISTRY_IMAGE/$IMAGE_NAME:$DEBIAN_RELEASE-$CI_COMMIT_SHA
-    - docker push $CI_REGISTRY_IMAGE/$IMAGE_NAME:$DEBIAN_RELEASE
+    - /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $IMAGE_NAME/Dockerfile --build-arg DEBIAN_RELEASE=$DEBIAN_RELEASE --destination $CI_REGISTRY_IMAGE/$IMAGE_NAME:$DEBIAN_RELEASE-$CI_COMMIT_SHA --destination $CI_REGISTRY_IMAGE/$IMAGE_NAME:$DEBIAN_RELEASE
 
 .build-stretch:
   extends: .build
-- 
GitLab