Commit eb83b47e authored by Vũ Hoàng Anh's avatar Vũ Hoàng Anh

ci: simplify deploy using local shell commands

parent 91dd0c2e
Pipeline #3299 failed with stage
in 0 seconds
...@@ -3,22 +3,13 @@ stages: ...@@ -3,22 +3,13 @@ stages:
deploy_to_server: deploy_to_server:
stage: deploy stage: deploy
image: alpine:latest # Không dùng image vì chạy shell trực tiếp trên host
before_script:
- apk add --no-cache openssh-client git
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- ssh-keyscan 172.16.2.207 >> ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
script: script:
- ssh anhvh@172.16.2.207 " - echo "🚀 Bắt đầu quá trình Deploy trực tiếp trên Server..."
cd /home/anhvh/chatbot-canifa && - cd /home/anhvh/chatbot-canifa
git pull origin master && - git pull origin master
cd backend && - cd backend
docker compose up --build -d - docker compose up --build -d
" - echo "✅ Deploy thành công!"
only: only:
- master - master
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment