-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* [chore] : gitignore에 application.yml 추가 * [chore] : 운영 서버 cd 스크립트 추가 * [rename] : 개발 서버 cd 스크립트 이름 변경 * [chore] : 서버 배포 테스트 * [chore] : 배포 스크립트 임시 추가 부분 삭제 * [chore] : 변수형에 postfix 추가 및 배포 테스트 * [chore] : cd_dev.yml 배포 테스트 부분 삭제 * [chore] : 운영 서버 도메인 접속 허용 * [chore] : swagger serverlist 삭제 * [chore] : secret 변수명 변경 * [chore] : 배포 스크립트 임시로 추가된 부분 삭제
- Loading branch information
Showing
5 changed files
with
93 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
name: Dev Server Deploy | ||
|
||
on: | ||
push: | ||
branches: ["dev"] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
build-and-push-image: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: 자바 버전 설정 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
|
||
- name: main 경로 application.yml 파일 생성 | ||
run: | | ||
mkdir -p ./src/main/resources | ||
echo "${{ secrets.APPLICATION_YML_DEV }}" | base64 -d > ./src/main/resources/application.yml | ||
- name: gradle 권한 부여 | ||
run: chmod +x ./gradlew | ||
shell: bash | ||
|
||
- name: 빌드 시 캐시 적용 | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.gradle/caches | ||
~/.gradle/wrapper | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | ||
restore-keys: | | ||
${{ runner.os }}-gradle- | ||
- name: 빌드 | ||
run: ./gradlew build -x test | ||
|
||
- name: 도커 허브 로그인 | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME_DEV }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN_DEV }} | ||
|
||
- name: 도커 이미지 빌드 및 푸시 | ||
run: | | ||
docker build -f Dockerfile -t ${{ secrets.DOCKERHUB_USERNAME_DEV }}/${{ secrets.DOCKERHUB_APP_NAME }} . | ||
docker push ${{ secrets.DOCKERHUB_USERNAME_DEV }}/${{ secrets.DOCKERHUB_APP_NAME }} | ||
deploy: | ||
needs: build-and-push-image | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: 이미지 pull 받아서 백그라운드 실행 | ||
uses: appleboy/ssh-action@master | ||
with: | ||
host: ${{ secrets.EC2_HOST_DEV }} | ||
username: ${{ secrets.EC2_USERNAME }} | ||
key: ${{ secrets.EC2_KEY_DEV }} | ||
port: ${{ secrets.EC2_PORT }} | ||
script: | | ||
cd compose | ||
docker rm -f $(docker ps -qa) | ||
docker pull ${{ secrets.DOCKERHUB_USERNAME_DEV }}/${{ secrets.DOCKERHUB_APP_NAME }} | ||
docker-compose up -d | ||
docker system prune -f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters