Updated deployment to new context
This commit is contained in:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user