Commit 21c04a4e authored by George Papathanail's avatar George Papathanail
Browse files

update pipeline

parent 310f9d35
Loading
Loading
Loading
Loading
Loading
+6 −36
Original line number Original line Diff line number Diff line
stages:
build with kaniko:
  - build
  stage: build

  tags:
generate_docker_image:
    - kaniko
  image:
  image:
    name: gcr.io/kaniko-project/executor:v1.23.2-debug
    name: gcr.io/kaniko-project/executor:v1.23.2-debug
    entrypoint: [""]
    entrypoint: [""]
  stage: build
  rules:
    - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
      when: on_success
    - if: '$CI_COMMIT_TAG'
      when: on_success
    - when: never
  script:
  script:
    # Create Kaniko Docker auth config
    - mkdir -p /kaniko/.docker
    - echo "{\"auths\":{\"$CI_REGISTRY\":{\"auth\":\"$(echo -n $CI_REGISTRY_USER:$CI_REGISTRY_PASSWORD | base64)\"}}}" > /kaniko/.docker/config.json


    # Determine tag to use
    - |
      if [ -n "$CI_COMMIT_TAG" ]; then
        TAG="$CI_COMMIT_TAG"
      elif [ -n "$RELEASE_VERSION" ]; then
        TAG="$RELEASE_VERSION"
      else
        TAG="latest"
      fi

    

    # Build and push the image
    - /kaniko/executor \
        --context $CI_PROJECT_DIR \
        --dockerfile $CI_PROJECT_DIR/Dockerfile \
        --destination $CI_REGISTRY_IMAGE:$TAG \
        --destination $CI_REGISTRY_IMAGE:latest \
        $KANIKOBUILDARGS \
        --verbosity=info


    # conventional project with Dockerfile inside root dir
    - /kaniko/executor --no-push