diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7170c128dae3f58ee8707b50e814e347a3176cd8..e936749f8da73a1ede0e72bd63a1fdacb3ac3c4c 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: