-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (54 loc) · 1.96 KB
/
deploy-docker.yaml
File metadata and controls
71 lines (54 loc) · 1.96 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
62
63
64
65
66
67
68
69
70
name: Build and Deploy Docker Image
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Node and NPM
uses: actions/setup-node@v3
with:
node-version: 18.14.0
- name: Install Client NPM Packages
run: npm ci
working-directory: client
- name: Compile Client
run: npm run production
working-directory: client
- name: Install WSS NPM Packages
run: npm ci
working-directory: wss
- name: Compile WSS
run: npm run production
working-directory: wss
- name: Build HTTP Docker Image
run: docker build -f Dockerfile.http -t codewithkyle/tabletopper-http:prod .
- name: Save HTTP Docker Image as Tarball
run: docker save -o tabletopper-http.tar codewithkyle/tabletopper-http:prod
- name: Build WSS Docker Image
run: docker build -f Dockerfile.wss -t codewithkyle/tabletopper-wss:prod .
- name: Save WSS Docker Image as Tarball
run: docker save -o tabletopper-wss.tar codewithkyle/tabletopper-wss:prod
- name: Load SSH Key
uses: webfactory/ssh-agent@v0.9.0
with:
ssh-private-key: ${{ secrets.SSHKEY }}
- name: Deploy
run: scp -o StrictHostKeyChecking=no ./tabletopper-http.tar ./tabletopper-wss.tar ${{ secrets.USERNAME }}@${{ secrets.HOST }}:~/
- name: Post Deployment
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
USERNAME: ${{ secrets.USERNAME }}
PORT: 22
KEY: ${{ secrets.SSHKEY }}
script: docker load -i ~/tabletopper-wss.tar && docker load -i ~/tabletopper-http.tar
- name: Purge cache
uses: nathanvaughn/actions-cloudflare-purge@master
if: success()
with:
cf_zone: ${{ secrets.CLOUDFLARE_ZONE }}
cf_auth: ${{ secrets.CLOUDFLARE_AUTH_KEY }}