-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (45 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
54
name: DEV 배포
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
environment: dev
name: build image
steps:
- name: get repo from github
uses: actions/checkout@v3
- name: setup jdk17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Gradle Ready
run: chmod +x gradlew
- name: Gradle Build
run: ./gradlew clean build -x test
- name: Docker Login
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and Push Docker Image
run: |
docker build -t ${{ secrets.DOCKER_USERNAME }}/familynote:latest .
docker push ${{ secrets.DOCKER_USERNAME }}/familynote:latest
deploy:
needs: build
runs-on: ubuntu-latest
environment: dev
steps:
- name: Deploy to NCP
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.NCP_HOST }}
username: ${{ secrets.NCP_USERNAME }}
password: ${{ secrets.NCP_PASSWORD }}
port: ${{ secrets.NCP_PORT }}
script: |
sudo docker-compose -f /root/docker-compose.yml pull
sudo docker-compose -f /root/docker-compose.yml up -d
sudo docker run -d ${{ secrets.DOCKER_USERNAME }}/familynote:latest