From 0301ace4a01bcb818b97a2e82996b117806aa74b Mon Sep 17 00:00:00 2001 From: Daniel Date: Sat, 7 Mar 2026 14:00:45 +0100 Subject: [PATCH] Add: Auto-Deploy nach erfolgreichem CI Build - Deploy-Stage in CI: SSH auf adriahub nach Build - deploy.sh auf adriahub: pull + recreate Container - Nur auf main Branch, nach erfolgreichem Build Co-Authored-By: Claude Opus 4.6 --- .gitlab-ci.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index dea7a33..f16b0c4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,5 +1,6 @@ stages: - build + - deploy variables: INTERNAL_REGISTRY: "192.168.1.100:9080" @@ -61,3 +62,17 @@ docker-build: --cache-repo="$IMAGE_NAME/cache" \ --insecure-registry=$INTERNAL_REGISTRY \ $DESTINATIONS + +deploy: + stage: deploy + image: alpine:latest + needs: [docker-build] + rules: + - if: $CI_COMMIT_BRANCH == "main" + before_script: + - apk add --no-cache openssh-client + - mkdir -p ~/.ssh + - echo "$DEPLOY_SSH_KEY" | base64 -d > /tmp/deploy_key + - chmod 600 /tmp/deploy_key + script: + - ssh -i /tmp/deploy_key -o StrictHostKeyChecking=no root@100.79.45.50 "/mnt/cache/appdata/gaming-hub/deploy.sh"