diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..b3914d9 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,24 @@ +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: Build Gradle with JIB + run: ./gradlew clean --stacktrace -PtagName=$GITHUB_REF_NAME --build-file=./auth/build.gradle.kts -Djib.console=plain -Djib.useOnlyProjectCache=true jib \ No newline at end of file diff --git a/auth/build.gradle.kts b/auth/build.gradle.kts index 183bf35..d34b7e5 100644 --- a/auth/build.gradle.kts +++ b/auth/build.gradle.kts @@ -1,5 +1,6 @@ plugins { + id("com.google.cloud.tools.jib") version "3.3.2" } dependencies { @@ -19,4 +20,36 @@ project.delete( kotlin.sourceSets.main { kotlin.srcDir("$buildDir/generated/source/kapt/main") +} + +// JIB CI설정 +val tagName = project.properties["tagName"] +val regex = Regex("^v") + +jib { + from { + image = "eclipse-temurin:17" + } + to { + image = "johnpark0921/oauth2-app:$tagName" +// if(regex.containsMatchIn(tagName as String)) { +// tags = setOf("latest") +// } + } + container { + labels.set( + mapOf( + "maintainer" to "yoonho " + ) + ) + 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 + ) + } } \ No newline at end of file diff --git a/auth/src/main/resources/application-auth.yaml b/auth/src/main/resources/application-auth.yaml index 207a637..274cce2 100644 --- a/auth/src/main/resources/application-auth.yaml +++ b/auth/src/main/resources/application-auth.yaml @@ -1,4 +1,3 @@ - server: port: 9000 spring: @@ -53,8 +52,8 @@ vault: uri: http://localhost:8200 token: app-role: - role-id: 9f85afd3-01cc-5e53-17e8-d408addbd711 - secret-id: f6b4049b-e191-35df-de8f-484a875854bf + role-id: ff40ec6f-3120-7a01-b114-7a6a34fa497b + secret-id: 4d64cbeb-6c66-7136-7766-701cbd0856d7 secret: appconfig: oauth2-app/local