-
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.
Merge branch 'chrore/#23' into develop
- Loading branch information
Showing
8 changed files
with
119 additions
and
5 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 |
---|---|---|
@@ -1,4 +1,8 @@ | ||
FROM openjdk:21 | ||
ARG JAR_FILE=build/libs/*.jar | ||
COPY ${JAR_FILE} app.jar | ||
|
||
ARG PROFILE=local | ||
ENV SPRING_PROFILES_ACTIVE=${PROFILE} | ||
|
||
ENTRYPOINT ["java","-jar","/app.jar"] |
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,76 @@ | ||
pipeline { | ||
agent any | ||
|
||
tools { | ||
jdk 'JDK21' | ||
} | ||
|
||
environment { | ||
DOCKERHUB_CREDENTIALS = credentials('dockerhub-credentials-id') | ||
DOCKER_IMAGE = credentials('docker-image') | ||
K8S_URL = credentials('k8s-url') | ||
K8S_NAMESPACE = credentials('k8s-namespace') | ||
K8S_DEPLOY_NAME = credentials('k8s-deploy-name') | ||
JAVA_HOME = "${tool 'JDK21'}" | ||
PATH = "${env.JAVA_HOME}/bin:${env.PATH}" | ||
} | ||
|
||
stages { | ||
stage('Checkout') { | ||
steps { | ||
checkout scm | ||
} | ||
} | ||
|
||
stage('Build & Test') { | ||
steps { | ||
script { | ||
sh './gradlew clean build' | ||
sh './gradlew openapi3' | ||
} | ||
} | ||
post { | ||
failure { | ||
error 'Deployment failed!' | ||
} | ||
} | ||
} | ||
|
||
stage('Login'){ | ||
steps{ | ||
sh 'echo $DOCKERHUB_CREDENTIALS_PSW | docker login -u $DOCKERHUB_CREDENTIALS_USR --password-stdin' // docker hub 로그인 | ||
} | ||
} | ||
|
||
stage('Build & Push Docker Image') { | ||
steps { | ||
script { | ||
sh 'docker buildx build --push --platform linux/amd64 --build-arg PROFILE=prod -t $DOCKER_IMAGE .' | ||
} | ||
} | ||
} | ||
|
||
stage('ssh-test') { | ||
steps{ | ||
script{ | ||
sshagent (credentials: ['ncp-key']) { | ||
sh """ | ||
ssh -o StrictHostKeyChecking=no ${K8S_URL} << EOF | ||
microk8s kubectl rollout restart deploy ${K8S_DEPLOY_NAME} -n=${K8S_NAMESPACE} | ||
""" | ||
} | ||
} | ||
} | ||
} | ||
|
||
} | ||
|
||
post { | ||
success { | ||
echo 'Deployment was successful!' | ||
} | ||
failure { | ||
error 'Deployment failed!' | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
spring: | ||
config: | ||
activate: | ||
on-profile: prod | ||
jpa: | ||
properties: | ||
hibernate: | ||
show_sql: true | ||
format_sql: true | ||
use_sql_comments: true | ||
hibernate: | ||
ddl-auto: update | ||
|
||
server: | ||
forward-headers-strategy: framework | ||
|
||
management: | ||
endpoints: | ||
enabled-by-default: false | ||
web: | ||
base-path: /api/health-check | ||
endpoint: | ||
health: | ||
enabled: true | ||
|
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