Some checks failed
Deploy Smart-search Backend / deploy (push) Failing after 1m36s
41 lines
1.1 KiB
YAML
41 lines
1.1 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 'cd /home/n8n && docker-compose up -d'
|
|
|
|
- name: Done
|
|
run: echo "✅ Backend deployed!"
|