Commit 92af7258 authored by George Papathanail's avatar George Papathanail
Browse files

test kaniko for building

parent 23918d23
Loading
Loading
Loading
Loading
Loading
+20 −3
Original line number Diff line number Diff line
stages:
  - build

kaniko_test_build:
kaniko_build_and_push:
  image:
    name: gcr.io/kaniko-project/executor:debug
    name: gcr.io/kaniko-project/executor:v1.20.0
    entrypoint: [""]
  stage: build
  script:
    - mkdir -p /kaniko/.docker

    # Registry authentication
    - echo "{\"auths\":{\"$CI_REGISTRY\":{\"auth\":\"$(echo -n \"$CI_REGISTRY_USER:$CI_REGISTRY_PASSWORD\" | base64)\"}}}" > /kaniko/.docker/config.json

    # Set tag from CI_COMMIT_TAG, RELEASE_VERSION or default to latest
    - |
      if [ -n "$CI_COMMIT_TAG" ]; then
        TAG="$CI_COMMIT_TAG"
      elif [ -n "$RELEASE_VERSION" ]; then
        TAG="$RELEASE_VERSION"
      else
        TAG="latest"
      fi

    # Run Kaniko to build and push
    - |
      /kaniko/executor \
        --context "${CI_PROJECT_DIR}" \
        --dockerfile "${CI_PROJECT_DIR}/Dockerfile" \
        --no-push \
        --destination "$CI_REGISTRY_IMAGE:$TAG" \
        --destination "$CI_REGISTRY_IMAGE:latest" \
        --verbosity=info