From 127b13868b9ec87642ae1e7318d1bcfb5dfd0e00 Mon Sep 17 00:00:00 2001 From: vhaudiquet Date: Fri, 3 Jan 2025 19:22:53 +0100 Subject: [PATCH] Updated deployment to new context --- .gitea/workflows/pipeline.yaml | 40 +++++++--------------------------- 1 file changed, 8 insertions(+), 32 deletions(-) diff --git a/.gitea/workflows/pipeline.yaml b/.gitea/workflows/pipeline.yaml index f8e3d2f..68e5eb5 100644 --- a/.gitea/workflows/pipeline.yaml +++ b/.gitea/workflows/pipeline.yaml @@ -73,35 +73,11 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.PACKAGES_TOKEN }} - - name: Docker Stack deploy - run: | - echo "Running: ${0} as: $(whoami) in: $(pwd)" - mkdir -p /root/.ssh - chmod 0700 /root/.ssh - ssh-keyscan -p "22" -H "192.168.1.105" >> /root/.ssh/known_hosts - echo -e "\u001b[36mAdding SSH Key to SSH Agent" - echo "${{ secrets.DEPLOY_SSH_PRIVATE_KEY }}" > /root/.ssh/id_rsa - chmod 0600 /root/.ssh/id_rsa - eval "$(ssh-agent -s)" - ssh-add /root/.ssh/id_rsa - echo -e "\u001b[36mVerifying Docker and Setting Context." - ssh -p "22" "root@192.168.1.105" "docker info" > /dev/null - docker context create remote --docker "host=ssh://root@192.168.1.105:22" - docker context ls - docker context use remote - echo -e "\u001b[36mSourcing Environment File: .env" - stat ".env" - set -a - source ".env" - echo -e "\u001b[36mDeploying Stack: \u001b[37;1mlolstats" - docker stack deploy -c "docker-compose.yml" "lolstats" --with-registry-auth - - - name: Docker Deploy cleanup - run: | - eval "$(ssh-agent -s)" - ssh-add -D - rm /root/.ssh/known_hosts - rm /root/.ssh/id_rsa - docker context use default - docker context rm remote - + - name: Docker Stack deploy + uses: leonidgrishenkov/docker-stack-deploy@v1.2.3 + with: + remote_host: docker-prod.local + remote_user: root + remote_private_key: ${{ secrets.DEPLOY_SSH_PRIVATE_KEY }} + stack_file: "docker-compose.yml" + stack_name: "lolstats"