-
Notifications
You must be signed in to change notification settings - Fork 265
47 lines (39 loc) · 1.2 KB
/
build-and-upload.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
name: Build and Upload
on:
push:
branches:
- dev
jobs:
build:
runs-on: ubuntu-latest
if: github.event.repository.fork == false
environment:
name: "dev"
url: ${{ vars.URL }}
steps:
- uses: actions/checkout@v3
- name: Build Docker image
run: docker build -t hngdevops/nextjs-boilerplate:dev -f docker/development/Dockerfile .
- name: Save and compress Docker image
run: |
docker save hngdevops/nextjs-boilerplate:dev > nextjs-dev.tar
gzip nextjs-dev.tar
- name: Copy to server
uses: appleboy/scp-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
source: "nextjs-dev.tar.gz"
target: "/tmp/nextjs"
- name: Load image in server
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
script: |
cd /tmp/nextjs
gunzip nextjs-dev.tar.gz
docker load < nextjs-dev.tar
rm -f nextjs-dev.tar