-
Notifications
You must be signed in to change notification settings - Fork 1
52 lines (45 loc) · 1.38 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
name: deploy
on:
push:
branches: ["production"]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: 🗃️ Checkout
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: 📦 Build image
uses: docker/build-push-action@v4
with:
context: .
outputs: type=docker,dest=./web-client.tar
tags: sinzak-web
cache-from: type=gha
cache-to: type=gha,mode=max
- name: 📦 Ship image archive to remote server
uses: appleboy/scp-action@master
with:
username: ec2-user
host: ${{ secrets.HOST_DEV }}
key: ${{ secrets.SSH_PEM_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
source: "./web-client.tar"
target: "/home/ec2-user/deploy-web"
strip_components: 0
- name: Deploy
uses: appleboy/ssh-action@master
id: deploy-prod
with:
host: ${{ secrets.HOST_DEV }}
username: ec2-user
key: ${{ secrets.SSH_PEM_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
port: 22
script: |
cd ./deploy-web
docker load --input ./web-client.tar
docker container stop sinzak-web
docker run -d --rm -p 3000:3000 --name sinzak-web sinzak-web