diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c2603b34721d8e7bd82cc854146a750177306bb6..be7f76fec115dbdb4bf8acc90284049d051663df 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -11,13 +11,16 @@ stages: name: gcr.io/kaniko-project/executor:debug entrypoint: [""] script: - # This is not the common Authentication config, unknown reason why common config fails + # define script variables, they are passed in build time + - IMAGE_DESTINATION = ${CI_REGISTRY_IMAGE}/${IMAGE_NAME}:${TAG} + # Prepare Kaniko configuration file - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json - # - echo "{\"auths\":{\"$CI_REGISTRY\":{\"auth\":\"$(echo -n ${CI_REGISTRY_USER}:${CI_REGISTRY_PASSWORD} | base64)\"}}}" > /kaniko/.docker/config.json - - /kaniko/executor --context "$CI_PROJECT_DIR/$CONTEXT_DIR" --dockerfile "$CI_PROJECT_DIR/$CONTEXT_DIR/$DOCKERFILE" + # Build and push the image from the Dockerfile at the root of the project. + - /kaniko/executor --context "$CI_PROJECT_DIR/$CONTEXT_DIR" --dockerfile "$CI_PROJECT_DIR/$CONTEXT_DIR/$DOCKERFILE" --destination "${CI_REGISTRY_IMAGE}/${IMAGE_NAME}:${TAG}" $BUILD_ARGS # Print the full registry path of the pushed image - echo "Image pushed to ${CI_REGISTRY_IMAGE}/${IMAGE_NAME}:${TAG}" + - echo "${IMAGE_DESTINATION}" environment: stage: environment