diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 03b62c28ce50a9d2ffb5a6f8ebf2b1a358bddacd..c122d476f7828e65ef034b3411b6d0befb04a58a 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: