Add deployment steps to build workflow for Docker containers
All checks were successful
Build Backend Application and Docker Image / build-docker (push) Successful in 10m45s
Build Backend Application and Docker Image / deploy-stack (push) Successful in 3m41s

This commit is contained in:
Siwat Sirichai 2025-08-10 18:27:39 +07:00
parent 29b97ded2a
commit d35a9ae532

View file

@ -32,3 +32,20 @@ jobs:
file: ./Dockerfile file: ./Dockerfile
push: true push: true
tags: git.siwatsystem.com/adsist-cms/worker:latest tags: git.siwatsystem.com/adsist-cms/worker:latest
deploy-stack:
needs: build-docker
runs-on: adsist
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up SSH connection
run: |
mkdir -p ~/.ssh
echo "${{ secrets.DEPLOY_KEY_CMS }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan -H ${{ vars.DEPLOY_HOST_CMS }} >> ~/.ssh/known_hosts
- name: Deploy stack
run: |
echo "Pulling and starting containers on server..."
ssh -i ~/.ssh/id_rsa ${{ vars.DEPLOY_USER_CMS }}@${{ vars.DEPLOY_HOST_CMS }} "cd ~/cms-system-k8s && docker compose pull && docker compose up -d"