-
Notifications
You must be signed in to change notification settings - Fork 1
Chore #1 CICD 구축 #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
8ef0f73
chore: CI/CD workflows
katejhee 4706fa5
fix:.gitignore 수정
katejhee 1874d70
chore:dockerfile,workflow생성
katejhee 64d4b4f
fix:dockerfile,workflow수정
katejhee d81bcb1
fix:dev.deploy 수정
katejhee 9a7ad11
fix:.env를 .gitignore로 이동
katejhee ab75194
fix:루트경로 매핑
katejhee 62392e9
fix:deploy,build-dev 이름 변경, deploy-dev.yml 내용수정, 필요없는 파일 삭제
katejhee db7ddca
fix:.env를 .gitignore로 옮김
katejhee eb824f4
fix:deploy.yml 에서 deploy와 build 분리
katejhee 5d6788d
fix:needs:build추가
katejhee 38a1234
fix:개행 추가
katejhee cb1b1f2
fix:dockeerfile에 개행 추가
katejhee f21336a
fix:build-dev에 개행 추가
katejhee 12c8790
fix:deploy-dev.yml, build-dev.yml 수정
katejhee 98a58a5
fix:.env 하나 제거
katejhee c695907
fix:deploy-dev.yml 수정
katejhee f07253c
fix:.gitignore에 Caddyfile과 localhost.pem추가
katejhee 3c5bffc
fix:.gitignore수정
katejhee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,48 @@ | ||
| name: Build Job (Dev) | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ dev ] | ||
| pull_request: | ||
| branches: [ dev ] | ||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout source code | ||
| uses: actions/checkout@v3 | ||
|
|
||
| - name: Set up JDK 21 | ||
| uses: actions/setup-java@v3 | ||
| with: | ||
| java-version: '21' | ||
| distribution: 'temurin' | ||
|
|
||
| - name: Set up Gradle cache | ||
| uses: actions/cache@v3 | ||
| with: | ||
| path: | | ||
| ~/.gradle/caches | ||
| ~/.gradle/wrapper | ||
| key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | ||
| restore-keys: | | ||
| gradle-${{ runner.os }} | ||
|
|
||
| - name: Grant execute permission for gradlew | ||
| run: chmod +x ./gradlew | ||
|
|
||
| - name: Build with Gradle | ||
| run: ./gradlew clean build | ||
|
|
||
| - name: Log in to Docker Hub | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| username: ${{ secrets.DOCKER_USERNAME }} | ||
| password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
|
||
| - name: Build Docker image | ||
| run: docker build -t ${{ secrets.DOCKER_IMAGE_NAME }} . | ||
|
|
||
| - name: Push Docker image | ||
| run: docker push ${{ secrets.DOCKER_IMAGE_NAME }} | ||
This file contains hidden or 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,29 @@ | ||
| name: Deploy to EC2 | ||
katejhee marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| on: | ||
| workflow_run: | ||
| workflows: ["Build Job (Dev)"] | ||
| types: | ||
| - completed | ||
|
|
||
| jobs: | ||
| deploy: | ||
| if: ${{ github.event.workflow_run.conclusion == 'success' }} | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Deploy on EC2 via SSH | ||
| uses: appleboy/ssh-action@master | ||
| with: | ||
| host: ${{ secrets.EC2_HOST }} | ||
| username: ${{ secrets.EC2_USER }} | ||
| key: ${{ secrets.EC2_KEY }} | ||
| script: | | ||
| CURRENT_TZ=$(timedatectl | grep "Time zone" | awk '{print $3}') | ||
| if [ "$CURRENT_TZ" != "Asia/Seoul" ]; then | ||
| sudo timedatectl set-timezone Asia/Seoul | ||
| fi | ||
| docker pull ${{ secrets.DOCKER_IMAGE_NAME }} | ||
| docker stop bookmark-app || true | ||
| docker rm -f bookmark-app || true | ||
| docker run -d -p 8080:8080 --env-file ~/app/.env --name bookmark-app ${{ secrets.DOCKER_IMAGE_NAME }} | ||
This file contains hidden or 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 hidden or 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,3 @@ | ||
| FROM openjdk:21 | ||
| COPY build/libs/bookmark-0.0.1-SNAPSHOT.jar app.jar | ||
| ENTRYPOINT ["java", "-jar", "/app.jar"] |
Empty file.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.