Skip to content

Commit 2a0f5a8

Browse files
committed
automate deployment workflow
1 parent 4c105de commit 2a0f5a8

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Deploy to Hetzner
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- "mimir-rag/**"
9+
10+
jobs:
11+
deploy:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
17+
- name: Build Docker image
18+
run: docker build -t ${{ secrets.DOCKER_HUB_USERNAME }}/mimir-rag:latest -f mimir-rag/Dockerfile mimir-rag
19+
20+
- name: Push image to Docker Hub
21+
run: |
22+
echo ${{ secrets.DOCKER_HUB_TOKEN }} | docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} --password-stdin
23+
docker push ${{ secrets.DOCKER_HUB_USERNAME }}/mimir-rag:latest
24+
25+
- name: Deploy to Hetzner via SSH
26+
uses: appleboy/[email protected]
27+
with:
28+
host: ${{ secrets.HETZNER_HOST }}
29+
username: ${{ secrets.HETZNER_USERNAME }}
30+
key: ${{ secrets.SSH_PRIVATE_KEY }}
31+
script: |
32+
docker pull ${{ secrets.DOCKER_HUB_USERNAME }}/mimir-rag:latest
33+
docker stop mimir-rag || true
34+
docker rm mimir-rag || true
35+
docker run -d \
36+
--name mimir-rag \
37+
--restart unless-stopped \
38+
-p 127.0.0.1:3000:3000 \
39+
-v ~/.mimir-rag.env:/app/.env:ro \
40+
${{ secrets.DOCKER_HUB_USERNAME }}/mimir-rag:latest

0 commit comments

Comments
 (0)