-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (43 loc) · 1.35 KB
/
docker-image.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
name: Docker Image CI
on:
push:
branches: ["develop"]
jobs:
CI-CD:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'temurin'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
with:
arguments: build
cache-read-only: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/develop' }}
- name: Build with Gradle
run: ./gradlew build -x test
- name: Docker build & push
if: contains(github.ref, 'develop')
run: |
docker login -u yooonwodyd00 -p dbswodyd91
docker build -f Dockerfile -t yooonwodyd00/happynewhere_be-app .
docker push yooonwodyd00/happynewhere_be-app
## deploy to develop
- name: Deploy to dev
if: contains(github.ref, 'develop')
uses: appleboy/ssh-action@master
with:
host: 210.89.188.107
username: root
password: D8N9!79t3u
port: 3306
script: |
sudo docker ps
sudo docker pull yooonwodyd00/happynewhere_be-app
sudo docker compose down
sudo docker compose up -d