version: "1" stages: - build - push - deploy variables: IMAGE_NAME: angular-web-app TAG: ${CI_COMMIT_TAG:-latest} GITEA_REGISTRY: ${CI_REGISTRY} build-image: stage: build image: docker:latest services: - docker:dind before_script: - apk add --no-cache bash - chmod +x ./build.sh ./push-to-gitea.sh script: - echo "🏗️ Baue Docker-Image..." - ./build.sh "$IMAGE_NAME" "$TAG" artifacts: paths: - Dockerfile push-image: stage: push image: docker:latest services: - docker:dind before_script: - apk add --no-cache bash - chmod +x ./push-to-gitea.sh script: - echo "⬆️ Push zu Gitea Registry..." - | export GITEA_REGISTRY="${CI_REGISTRY}" export GITEA_USER="${CI_REGISTRY_USER}" export GITEA_TOKEN="${CI_REGISTRY_TOKEN}" ./push-to-gitea.sh "$IMAGE_NAME" "$TAG" only: - main - tags deploy: stage: deploy image: alpine:latest needs: - push-image only: - main - tags script: - echo "🚀 Deployment auf Zielserver starten..." - apk add --no-cache openssh-client docker-cli - echo "${DEPLOY_KEY}" > /tmp/deploy_key.pem - chmod 600 /tmp/deploy_key.pem - | ssh -i /tmp/deploy_key.pem -o StrictHostKeyChecking=no ${DEPLOY_USER}@${DEPLOY_HOST} <