Skip to content
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

[deploy] merge to main #8

Merged
merged 3 commits into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 74 additions & 0 deletions .github/workflows/dev-CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: dev-CI

on:
push:
branches: [ "develop" ]
pull_request:
branches: [ "develop" ]

jobs:
dev-ci:
# Using Environment - dev 환경
environment: dev

# Operating system - ubuntu-22.04
runs-on: ubuntu-22.04
permissions:
contents: read

steps:
# Checkout - 가상 머신에 체크아웃
- name: Checkout code
uses: actions/checkout@v3

# JDK setting - JDK 17 설정
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

# gradle caching - 빌드 시간 향상
- name: Gradle Caching
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-

# Inject environment variables - 환경 변수를 yml 파일에 주입
- name: Inject environment variables into application-dev.yml
env:
DEV_DB_URL: ${{ secrets.DEV_DB_URL }}
DEV_DB_USERNAME: ${{ secrets.DEV_DB_USERNAME }}
DEV_DB_PASSWORD: ${{ secrets.DEV_DB_PASSWORD }}
run: |
cd ./src/main/resources
envsubst < application-dev.yml > application-dev.tmp.yml && mv application-dev.tmp.yml application-dev.yml

# gradle build - 테스트 없이 gradle 빌드
- name: Build with Gradle
run: |
chmod +x gradlew
./gradlew build -x test
shell: bash

# Set up Docker Buildx - Docker Buildx 설치
- name: Set up Docker Buildx
uses: docker/[email protected]

# Log in to Docker Hub - Docker Hub 로그인
- name: Log in to Docker Hub
uses: docker/[email protected]
with:
username: ${{ secrets.DEV_DOCKER_LOGIN_USERNAME }}
password: ${{ secrets.DEV_DOCKER_LOGIN_ACCESSTOKEN }}

# Build and push Docker image - Docker image 빌드 및 푸시
- name: Build and push Docker image
run: |
docker build -f Dockerfile-dev --platform linux/amd64 -t hoonyworld/beat-dev .
docker push hoonyworld/beat-dev
74 changes: 74 additions & 0 deletions .github/workflows/prod-CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: prod-CI

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
prod-ci:
# Using Environment - prod 환경
environment: prod

# Operating system - ubuntu-22.04
runs-on: ubuntu-22.04
permissions:
contents: read

steps:
# Checkout - 가상 머신에 체크아웃
- name: Checkout code
uses: actions/checkout@v3

# JDK setting - JDK 17 설정
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

# gradle caching - 빌드 시간 향상
- name: Gradle Caching
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-

# Inject environment variables - 환경 변수를 yml 파일에 주입
- name: Inject environment variables into application-prod.yml
env:
PROD_DB_URL: ${{ secrets.PROD_DB_URL }}
PROD_DB_USERNAME: ${{ secrets.PROD_DB_USERNAME }}
PROD_DB_PASSWORD: ${{ secrets.PROD_DB_PASSWORD }}
run: |
cd ./src/main/resources
envsubst < application-prod.yml > application-prod.tmp.yml && mv application-prod.tmp.yml application-prod.yml

# gradle build - 테스트 없이 gradle 빌드
- name: Build with Gradle
run: |
chmod +x gradlew
./gradlew build -x test
shell: bash

# Set up Docker Buildx - Docker Buildx 설치
- name: Set up Docker Buildx
uses: docker/[email protected]

# Log in to Docker Hub - Docker Hub 로그인
- name: Log in to Docker Hub
uses: docker/[email protected]
with:
username: ${{ secrets.PROD_DOCKER_LOGIN_USERNAME }}
password: ${{ secrets.PROD_DOCKER_LOGIN_ACCESSTOKEN }}

# Build and push Docker image - Docker image 빌드 및 푸시
- name: Build and push Docker image
run: |
docker build --platform linux/amd64 -t donghoon0203/beat-prod .
docker push donghoon0203/beat-prod
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# 예외
!gradle/wrapper/gradle-wrapper.jar

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
Expand Down Expand Up @@ -173,4 +176,5 @@ Temporary Items
# iCloud generated files
*.icloud

# End of https://www.toptal.com/developers/gitignore/api/intellij,java,macos
# End of https://www.toptal.com/developers/gitignore/api/intellij,java,macos.gradle/
.idea/
Binary file removed .gradle/8.8/checksums/checksums.lock
Binary file not shown.
Binary file removed .gradle/8.8/checksums/md5-checksums.bin
Binary file not shown.
Binary file removed .gradle/8.8/checksums/sha1-checksums.bin
Binary file not shown.
Empty file.
Binary file removed .gradle/8.8/executionHistory/executionHistory.lock
Binary file not shown.
Binary file removed .gradle/8.8/fileChanges/last-build.bin
Binary file not shown.
Binary file removed .gradle/8.8/fileHashes/fileHashes.bin
Binary file not shown.
Binary file removed .gradle/8.8/fileHashes/fileHashes.lock
Binary file not shown.
Empty file removed .gradle/8.8/gc.properties
Empty file.
Binary file removed .gradle/buildOutputCleanup/buildOutputCleanup.lock
Binary file not shown.
2 changes: 0 additions & 2 deletions .gradle/buildOutputCleanup/cache.properties

This file was deleted.

Empty file removed .gradle/vcs-1/gc.properties
Empty file.
8 changes: 0 additions & 8 deletions .idea/.gitignore

This file was deleted.

15 changes: 0 additions & 15 deletions .idea/compiler.xml

This file was deleted.

20 changes: 0 additions & 20 deletions .idea/jarRepositories.xml

This file was deleted.

13 changes: 0 additions & 13 deletions .idea/material_theme_project_new.xml

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/misc.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

7 changes: 7 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM openjdk:17-alpine

WORKDIR /app

COPY ./build/libs/beat-0.0.1-SNAPSHOT.jar /app/beat.jar

CMD ["java", "-Duser.timezone=Asia/Seoul", "-jar", "-Dspring.profiles.active=prod", "beat.jar"]
7 changes: 7 additions & 0 deletions Dockerfile-dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM openjdk:17-alpine

WORKDIR /app

COPY ./build/libs/beat-0.0.1-SNAPSHOT.jar /app/beat.jar

CMD ["java", "-Duser.timezone=Asia/Seoul", "-jar", "-Dspring.profiles.active=dev", "beat.jar"]
6 changes: 5 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ dependencies {
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}

jar {
enabled = false
}

tasks.named('test') {
useJUnitPlatform()
}
}
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
16 changes: 0 additions & 16 deletions src/main/java/com/beat/common/dto/ErrorResponse.java

This file was deleted.

17 changes: 0 additions & 17 deletions src/main/java/com/beat/common/dto/SuccessResponse.java

This file was deleted.

9 changes: 0 additions & 9 deletions src/main/java/com/beat/exception/BadRequestException.java

This file was deleted.

9 changes: 0 additions & 9 deletions src/main/java/com/beat/exception/ForbiddenException.java

This file was deleted.

9 changes: 0 additions & 9 deletions src/main/java/com/beat/exception/NotFoundException.java

This file was deleted.

9 changes: 0 additions & 9 deletions src/main/java/com/beat/exception/UnauthorizedException.java

This file was deleted.

13 changes: 0 additions & 13 deletions src/main/java/com/beat/exception/beatException.java

This file was deleted.

12 changes: 0 additions & 12 deletions src/main/java/com/beat/exception/message/ErrorMessage.java

This file was deleted.

Loading
Loading