Compare commits
3 Commits
feature/fa
...
fc1420a0ea
| Author | SHA1 | Date | |
|---|---|---|---|
| fc1420a0ea | |||
| 80b13f2893 | |||
| 75b5328f27 |
19
Dockerfile
19
Dockerfile
@@ -7,7 +7,7 @@ RUN apk add --no-cache curl && \
|
||||
https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v${OTEL_VERSION}/opentelemetry-javaagent.jar \
|
||||
-o /opentelemetry-javaagent.jar
|
||||
|
||||
# 2단계: Tomcat 이미지 (Java 8 기준, Java 17 쓸 거면 jdk17-temurin 그대로 사용)
|
||||
# 2단계: Tomcat 이미지 (Java 8 기준)
|
||||
FROM tomcat:9.0-jdk8-temurin
|
||||
|
||||
ENV TZ=Asia/Seoul \
|
||||
@@ -15,23 +15,30 @@ ENV TZ=Asia/Seoul \
|
||||
OTEL_EXPORTER_OTLP_ENDPOINT=http://192.168.100.203:4317 \
|
||||
OTEL_EXPORTER_OTLP_PROTOCOL=grpc \
|
||||
OTEL_RESOURCE_ATTRIBUTES="deployment.environment=prod" \
|
||||
JAVA_TOOL_OPTIONS="-javaagent:/opt/opentelemetry-javaagent.jar"
|
||||
JAVA_TOOL_OPTIONS="\
|
||||
-Xms1g \
|
||||
-Xmx1g \
|
||||
-XX:+UseG1GC \
|
||||
-XX:MaxGCPauseMillis=200 \
|
||||
-XX:+UnlockExperimentalVMOptions \
|
||||
-XX:+UseStringDeduplication \
|
||||
-XX:+HeapDumpOnOutOfMemoryError \
|
||||
-XX:HeapDumpPath=/tmp \
|
||||
-XX:+DisableExplicitGC \
|
||||
-javaagent:/opt/opentelemetry-javaagent.jar"
|
||||
|
||||
# 타임존 설정
|
||||
RUN ln -sf /usr/share/zoneinfo/Asia/Seoul /etc/localtime
|
||||
|
||||
# OTEL 에이전트 복사
|
||||
COPY --from=otel /opentelemetry-javaagent.jar /opt/opentelemetry-javaagent.jar
|
||||
# OTEL 1000:1000 으로 구동 가능 하도록 처리
|
||||
RUN chown 1000:1000 /opt/opentelemetry-javaagent.jar
|
||||
|
||||
# 🔽 기본 웹앱 정리
|
||||
# 기본 웹앱 정리
|
||||
RUN rm -rf /usr/local/tomcat/webapps/*
|
||||
|
||||
# Maven 빌드된 WAR 복사
|
||||
# Maven 빌드 결과 파일명에 맞게 수정
|
||||
COPY target/sayit-helpdesk.war /usr/local/tomcat/webapps/ROOT.war
|
||||
# TOMCAT 구동전 톰캣은 1000:1000 으로 구동 할 수 있도록 조정
|
||||
RUN chown -R 1000:1000 /usr/local/tomcat/
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
20
Jenkinsfile
vendored
20
Jenkinsfile
vendored
@@ -1,9 +1,10 @@
|
||||
// Jenkinsfile — Kaniko build + K8s deploy (latest only)
|
||||
def L = 'kaniko-and-deploy'
|
||||
def REG = 'harbor.sayinfo.co.kr'
|
||||
def IMAGE = 'sayit-helpdesk/helpdesk-service' // Harbor 프로젝트/레포 이름에 맞게 유지 또는 수정
|
||||
def APP_NS = 'sayit-helpdesk' // 실제 K8s 네임스페이스와 일치해야 함
|
||||
def DEPLOY = 'sayit-helpdesk-service' // 실제 Deployment 이름과 일치해야 함
|
||||
// Jenkinsfile — Kaniko build + K8s deploy (빌드번호 태그 사용)
|
||||
def L = 'kaniko-and-deploy'
|
||||
def REG = 'harbor.sayinfo.co.kr'
|
||||
def IMAGE = 'sayit-helpdesk/helpdesk-service' // Harbor 프로젝트/레포 이름
|
||||
def APP_NS = 'sayit-helpdesk' // 실제 K8s 네임스페이스
|
||||
def DEPLOY = 'sayit-helpdesk-service' // 실제 Deployment 이름
|
||||
def IMAGE_TAG = "${env.BUILD_NUMBER}"
|
||||
|
||||
podTemplate(
|
||||
label: L,
|
||||
@@ -104,7 +105,7 @@ spec:
|
||||
/kaniko/executor \\
|
||||
--context=. \\
|
||||
--dockerfile=Dockerfile \\
|
||||
--destination=${REG}/${IMAGE}:latest \\
|
||||
--destination=${REG}/${IMAGE}:${IMAGE_TAG} \\
|
||||
--snapshot-mode=redo \\
|
||||
--skip-tls-verify \\
|
||||
--cache=true \\
|
||||
@@ -113,12 +114,11 @@ spec:
|
||||
}
|
||||
}
|
||||
|
||||
stage('Deploy to Kubernetes') {
|
||||
stage('Deploy to Kubernetes') {
|
||||
container('kubectl') {
|
||||
sh """
|
||||
set -eux
|
||||
kubectl -n ${APP_NS} set image deploy/${DEPLOY} ${DEPLOY}=${REG}/${IMAGE}:latest
|
||||
kubectl -n ${APP_NS} rollout restart deploy/${DEPLOY}
|
||||
kubectl -n ${APP_NS} set image deploy/${DEPLOY} ${DEPLOY}=${REG}/${IMAGE}:${IMAGE_TAG}
|
||||
kubectl -n ${APP_NS} rollout status deploy/${DEPLOY} --timeout=300s
|
||||
|
||||
kubectl -n ${APP_NS} get deploy ${DEPLOY} -o wide
|
||||
|
||||
Reference in New Issue
Block a user