Skip to content

Commit

Permalink
✨feature : 배포환경 작업
Browse files Browse the repository at this point in the history
  • Loading branch information
ParkYunHo committed Feb 25, 2024
1 parent f80c807 commit 4b9d1e5
Show file tree
Hide file tree
Showing 5 changed files with 106 additions and 4 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: ci

on:
push:
tags:
- 'v**'

jobs:
ci:
runs-on: ubuntu-latest
steps:
- name: Git Checkout
uses: actions/checkout@v2

- name: Setup JDK
uses: actions/setup-java@v1
with:
java-version: 17

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Dockerhub Login
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build Gradle with JIB (API)
run: ./gradlew clean --stacktrace -PtagName=$GITHUB_REF_NAME --build-file=./bootstrap/build.gradle.kts -Djib.console=plain -Djib.useOnlyProjectCache=true jib
41 changes: 40 additions & 1 deletion bootstrap/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import org.springframework.boot.gradle.tasks.bundling.BootJar

plugins {
id("com.google.cloud.tools.jib") version "3.3.2" // JIB 설정
}

dependencies {
implementation(project(":application"))
implementation(project(":framework:framework-mysql"))
Expand All @@ -9,10 +13,45 @@ dependencies {
implementation("org.springframework.boot:spring-boot-starter-aop")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
implementation("org.jetbrains.kotlin:kotlin-reflect")

implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:2.3.0")
}

val jar: Jar by tasks
val bootJar: BootJar by tasks

bootJar.enabled = true
jar.enabled = false
jar.enabled = false

// JIB 설정
val tagName = project.properties["tagName"] ?: ""
val regex = Regex("^v")

jib {
from {
image = "eclipse-temurin:17"
}
to {
image = "johnpark0921/teople:$tagName"
if(regex.containsMatchIn(tagName as String)) {
tags = setOf("latest")
}
}
container {
labels.set(
mapOf(
"maintainer" to "yoonho <qkrdbsgh0921@gmail.com>, mina <minaaa5814@gmail.com>"
)
)
creationTime.set("USE_CURRENT_TIMESTAMP")
setFormat("OCI")
environment = mapOf(
"TZ" to "Asia/Seoul"
)
jvmFlags = listOf(
"-Dsun.net.inetaddr.ttl=0", // DNS cache TTL
"-XX:+PrintCommandLineFlags", // Print JVM Flags
"-Dspring.profiles.active=prod" // profile 설정
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@ import java.io.Serializable

data class TokenResponse(
val token: String,
val userId: String
val userId: String,
val coupleId: String
): Serializable {

companion object {
fun of(input: TokenInfo): TokenResponse =
TokenResponse(
token = input.token,
userId = input.userId
userId = input.userId,
coupleId = input.coupleId
)
}
}
5 changes: 5 additions & 0 deletions bootstrap/src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,8 @@ spring:
profiles:
active: local
include: framework-mysql

springdoc:
default-consumes-media-type: application/json
swagger-ui:
path: /swagger-ui.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,30 @@ mysql:
username: root
password: root

---
---

spring:
config:
activate:
on-profile: deploy
jpa:
show-sql: true
hibernate:
ddl-auto: none
generate-ddl: true
datasource:
hikari:
connection-timeout: 5000
minimum-idle: 10
maximum-pool-size: 100

hibernate:
show_sql: false
format_sql: false
physical_naming_strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl

mysql:
teople:
url: jdbc:mysql://146.56.113.143:3306/TEOPLE?serverTimezone=UTC
username: root
password: root

0 comments on commit 4b9d1e5

Please sign in to comment.