-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (44 loc) · 1.41 KB
/
deploy.yml
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
name: CI
on:
push:
branches:
- master
env:
DEPLOY_PATH: ${{ secrets.PROJECT_PATH }}
BUILD_SCRIPT: npm run build:ts
BUILD_SCRIPT_OUTPUT: dist
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '20'
- name: Install env
run: echo ${{ secrets.ENV_FILE }} | base64 -d > .env
- name: Build Docker image
run: docker build --target prod-stage -t lib-ff .
- name: Save Docker image
run: docker save lib-ff > lib-ff.tar
- name: Copy Docker image to VPS
uses: appleboy/scp-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.SSHKEY }}
source: "lib-ff.tar"
target: "/tmp"
- name: Deploy to VPS
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.SSHKEY }}
script: |
docker stop lib-ff || true
docker rm lib-ff || true
docker load < /tmp/lib-ff.tar
docker run -d --name lib-ff -p 3000:3000 -v ${{ secrets.CERT_PATH }}:/app/certs -v /var/www/lib-api/storage:/app/storage --add-host host.docker.internal:172.17.0.1 lib-ff
- name: Print Info
run: echo "Deployed at hosting"