steps:
  build:
    image: plugins/kaniko
    settings:
      repo: ${FORGE_NAME}/${CI_REPO}
      registry: 
        from_secret: container_registry
      tags: latest,${CI_COMMIT_SHA},${CI_COMMIT_TAG}
      username: 
        from_secret: container_registry_username
      password: 
        from_secret: container_registry_password
      build-args: "BASE_URL=https://minimal-setups.hottis.de, RELEASETAG=${CI_COMMIT_SHA}"
      
      dockerfile: Dockerfile
    when:
      - event: [push,tag]

  deploy:
    image: portainer/kubectl-shell:latest
    secrets:
      - source: kube_config
        target: KUBE_CONFIG_CONTENT
    commands:
      - export IMAGE_TAG=$CI_COMMIT_SHA
      - printf "$KUBE_CONFIG_CONTENT" > /tmp/kubeconfig
      - export KUBECONFIG=/tmp/kubeconfig
      - ./deployment/deploy.sh
    when:
      - event: [push,tag]

