-
Notifications
You must be signed in to change notification settings - Fork 0
46 lines (43 loc) · 1.14 KB
/
Copy pathweb_workflow.yml
File metadata and controls
46 lines (43 loc) · 1.14 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
name: Build docker image, push to Docker registry, then deploy to VM
on:
push:
branches:
- main
paths-ignore:
- 'README.md'
- 'LICENSE'
jobs:
build:
name: Build and push docker image
runs-on: self-hosted
environment: prod
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Run docker build
run: docker build -t worktracker .
deploy:
name: Deploy to VM
runs-on: self-hosted
needs: build
environment: prod
steps:
- name: Copy docker-compose.yml
uses: appleboy/scp-action@v0.1.4
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_KEY }}
source: docker-compose.yml
target: worktracker
- name: Connect ssh, pull and run
uses: appleboy/ssh-action@v1.0.0
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_KEY }}
script: |
cd worktracker
docker compose down
docker compose pull
docker compose up -d