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 <noreply@anthropic.com>
This commit is contained in:
Daniel 2026-03-07 14:00:45 +01:00
parent 7ef4eefc55
commit 0301ace4a0

View file

@ -1,5 +1,6 @@
stages: stages:
- build - build
- deploy
variables: variables:
INTERNAL_REGISTRY: "192.168.1.100:9080" INTERNAL_REGISTRY: "192.168.1.100:9080"
@ -61,3 +62,17 @@ docker-build:
--cache-repo="$IMAGE_NAME/cache" \ --cache-repo="$IMAGE_NAME/cache" \
--insecure-registry=$INTERNAL_REGISTRY \ --insecure-registry=$INTERNAL_REGISTRY \
$DESTINATIONS $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"