-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (52 loc) · 1.69 KB
/
deploy.yml
File metadata and controls
61 lines (52 loc) · 1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
name: Deploy
on:
push:
branches: [main]
env:
REGISTRY: ghcr.io
REPO: barckcode/tf-mobility
jobs:
build-and-deploy:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push frontend
uses: docker/build-push-action@v6
with:
context: ./frontend
push: true
tags: ${{ env.REGISTRY }}/${{ env.REPO }}/frontend:latest,${{ env.REGISTRY }}/${{ env.REPO }}/frontend:${{ github.sha }}
- name: Build and push backend
uses: docker/build-push-action@v6
with:
context: ./backend
push: true
tags: ${{ env.REGISTRY }}/${{ env.REPO }}/backend:latest,${{ env.REGISTRY }}/${{ env.REPO }}/backend:${{ github.sha }}
- name: Build and push etl
uses: docker/build-push-action@v6
with:
context: ./etl
push: true
tags: ${{ env.REGISTRY }}/${{ env.REPO }}/etl:latest,${{ env.REGISTRY }}/${{ env.REPO }}/etl:${{ github.sha }}
- name: Deploy to server
uses: appleboy/ssh-action@v1
with:
host: ${{ secrets.DEPLOY_HOST }}
username: ${{ secrets.DEPLOY_USER }}
key: ${{ secrets.DEPLOY_SSH_KEY }}
script: |
cd /home/observer/tf-mobility
git pull origin main
docker compose build
docker compose up -d frontend backend
docker image prune -f