This commit is contained in:
39
.gitea/workflows/deploy.yml
Normal file
39
.gitea/workflows/deploy.yml
Normal file
@@ -0,0 +1,39 @@
|
||||
name: Deploy Smart Search Backend
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: docker
|
||||
container:
|
||||
image: docker:latest
|
||||
options: --privileged
|
||||
steps:
|
||||
- name: Install git
|
||||
run: apk add --no-cache git openssh-client
|
||||
|
||||
- name: Checkout code
|
||||
run: git clone --depth 1 https://git.techease.ru/Smart-search/smart-search-back.git /app && cd /app
|
||||
|
||||
- name: Login to Docker Hub
|
||||
run: |
|
||||
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
|
||||
|
||||
- name: Build Docker image
|
||||
run: |
|
||||
cd /app
|
||||
docker build -t smart-search-backend:latest .
|
||||
|
||||
- name: Deploy to server
|
||||
run: |
|
||||
mkdir -p ~/.ssh
|
||||
echo "${{ secrets.DEPLOY_KEY }}" > ~/.ssh/id_rsa
|
||||
chmod 600 ~/.ssh/id_rsa
|
||||
ssh-keyscan -H 185.185.142.203 >> ~/.ssh/known_hosts 2>/dev/null || true
|
||||
ssh -i ~/.ssh/id_rsa root@185.185.142.203 'cd /home/n8n && /usr/bin/docker compose up -d smart-search-backend'
|
||||
|
||||
- name: Done
|
||||
run: echo "✅ Backend deployed!"
|
||||
Reference in New Issue
Block a user