Updated deployment to new context
This commit is contained in:
@@ -74,34 +74,10 @@ jobs:
|
|||||||
password: ${{ secrets.PACKAGES_TOKEN }}
|
password: ${{ secrets.PACKAGES_TOKEN }}
|
||||||
|
|
||||||
- name: Docker Stack deploy
|
- name: Docker Stack deploy
|
||||||
run: |
|
uses: leonidgrishenkov/docker-stack-deploy@v1.2.3
|
||||||
echo "Running: ${0} as: $(whoami) in: $(pwd)"
|
with:
|
||||||
mkdir -p /root/.ssh
|
remote_host: docker-prod.local
|
||||||
chmod 0700 /root/.ssh
|
remote_user: root
|
||||||
ssh-keyscan -p "22" -H "192.168.1.105" >> /root/.ssh/known_hosts
|
remote_private_key: ${{ secrets.DEPLOY_SSH_PRIVATE_KEY }}
|
||||||
echo -e "\u001b[36mAdding SSH Key to SSH Agent"
|
stack_file: "docker-compose.yml"
|
||||||
echo "${{ secrets.DEPLOY_SSH_PRIVATE_KEY }}" > /root/.ssh/id_rsa
|
stack_name: "lolstats"
|
||||||
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
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user