-
Notifications
You must be signed in to change notification settings - Fork 0
94 lines (94 loc) · 3.79 KB
/
gradle.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
## This workflow uses actions that are not certified by GitHub.
## They are provided by a third-party and are governed by
## separate terms of service, privacy policy, and support
## documentation.
## This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
## For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle
##
#name: Java CI with Gradle
#####
#on: # 이벤트 트리거
# push: #push 이벤트 발생시
# branches: #어떤 브랜치에서
# - develop
# pull_request: #pull_request 발생시
# branches: #어떤 브랜치에서
# - develop
#
#permissions: #작업에 필요한 권환₩#
# contents: read
#
#jobs: #작업을 정의
# build-docker-image:
# runs-on: ubuntu-latest # Ubunt 환경에서 작업을 실행
#
# steps: #작업 단계 정의
# - uses: actions/checkout@v3 #현재 레퍼지토리를 체크아웃
# - name: Set up JDK 11 #JDK 11 설치
# uses: actions/setup-java@v3 #JDK 11을 설치하는 액션을 사용
# with:
# java-version: '11'
# distribution: 'temurin'
#
# - name: Copy Firebase
# env:
# FIREBASE: ${{ secrets.FIREBASE }}
# FIREBASE_DIR: src/main/resources/key
# FIREBASE_DIR_FILE_NAME: just-firebase-key.json
# run: |
# mkdir -p $FIREBASE_DIR
# echo $FIREBASE | base64 --decode > $FIREBASE_DIR/$FIREBASE_DIR_FILE_NAME
#
# - name: Copy Secret
# env:
# OCCUPY_SECRET: ${{ secrets.OCCUPY_SECRET }}
# OCCUPY_SECRET_DIR: src/main/resources
# OCCUPY_SECRET_DIR_FILE_NAME: application.yml
# run: echo $OCCUPY_SECRET | base64 --decode > $OCCUPY_SECRET_DIR/$OCCUPY_SECRET_DIR_FILE_NAME
#
# - name: Build with Gradle #Gradle이용하여 빌드
# uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1
# with:
# gradle-version: 7.2 #그래들 버전 7.2 사용
# arguments: clean build -x test
# # 2. Docker Registry 실행
# - name: docker registry run
# run: docker run --name private-repo -d -p 5000:5000 registry
#
# # 3. Docker 이미지 빌드
# - name: docker image build
# run: docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/just .
#
# # 4. DockerHub 로그인
# - name: docker login
# uses: docker/login-action@v2
# with:
# username: ${{ secrets.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_PASSWORD }}
# - name: docker tag
# run: docker tag &{{ secrets.DOCKERHUB_USERNAME }}/just localhost:5000/${{ secrets.DOCKERHUB_USERNAME }}/just
# # 5. Docker Hub 이미지 푸시
# - name: docker Hub push
# run: docker push localhost:5000/${{ secrets.DOCKERHUB_USERNAME }}/just
# #
# run-docker-image-on-ec2:
# # build-docker-image (위)과정이 완료되어야 실행됩니다.
# needs: build-docker-image
# runs-on: self-hosted
#
# steps:
# - name: docker rmi
# run: docker rmi 13.209.213.191:5000/${{ secrets.DOCKERHUB_USERNAME }}/just:latest
# # 1. 최신 이미지를 풀받습니다
# - name: docker pull
# run: sudo docker pull 13.209.213.191:5000/${{ secrets.DOCKERHUB_USERNAME }}/just:latest
#
# # 2. 기존의 컨테이너를 중지시킵니다
# - name: docker stop container
# run: sudo docker stop $(sudo docker ps -q) 2>/dev/null || true
#
# # 3. 최신 이미지를 컨테이너화하여 실행시킵니다
# - name: docker run new container
# run: sudo docker run 13.209.213.191:5000/${{ secrets.DOCKERHUB_USERNAME }}/just:latest
#
#