Files
smart-search-back/.gitea/workflows/deploy.yml
vallyenfail 7d98984f8d
Some checks failed
Deploy Smart Search Backend / deploy (push) Has been cancelled
add service
2026-01-20 17:15:21 +03:00

43 lines
1.2 KiB
YAML

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 '
docker rm -f smart-search-backend 2>/dev/null || true
cd /home/n8n && /usr/bin/docker compose up -d smart-search-backend
'
- name: Done
run: echo "✅ Backend deployed!"