From 474eda508c0bb7c303b0d7e3e3dea8a0695ad576 Mon Sep 17 00:00:00 2001
From: Jose Semedo <jose.semedo@cern.ch>
Date: Fri, 15 Sep 2023 15:00:32 +0200
Subject: [PATCH] Update file .gitlab-ci.yml

---
 .gitlab-ci.yml | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 03b62c2..c122d47 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -13,10 +13,18 @@ stages:
 
 .build:
   stage: Build
-  tags:
-    - docker-image-build
+  image: 
+    # The kaniko debug image is recommended because it has a shell, and a shell is required for an image to be used with GitLab CI/CD.
+    name: gcr.io/kaniko-project/executor:debug
+    entrypoint: [""]
   script:
     - "echo 'Building docker image'"
+    # Prepare Kaniko configuration file
+    - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
+    # Build and push the image from the Dockerfile at the root of the project.
+    - /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $TO
+    # Print the full registry path of the pushed image
+    - echo "Image pushed successfully to ${TO}"
 
 # If a new tag is pushed it needs to be referenced into the ImageStream
 .tag_image:
-- 
GitLab