share job

This commit is contained in:
JAE SIK CHO
2026-04-09 11:12:12 +09:00
commit f8427ee1d0
193 changed files with 23830 additions and 0 deletions

96
Jenkinsfile vendored Normal file
View File

@@ -0,0 +1,96 @@
pipeline {
agent any
environment {
DOCKER_REGISTRY = "${env.DOCKER_REGISTRY ?: 'localhost:5000'}"
IMAGE_BACKEND = "${DOCKER_REGISTRY}/gw-backend"
IMAGE_FRONTEND = "${DOCKER_REGISTRY}/gw-frontend"
GIT_COMMIT_SHORT = sh(script: 'git rev-parse --short HEAD', returnStdout: true).trim()
IMAGE_TAG = "${env.BUILD_NUMBER}-${GIT_COMMIT_SHORT}"
}
options {
buildDiscarder(logRotator(numToKeepStr: '10'))
timeout(time: 30, unit: 'MINUTES')
}
stages {
stage('Checkout') {
steps {
checkout scm
}
}
stage('Backend Build') {
steps {
dir('NEW/backend') {
sh './gradlew clean build -x test --no-daemon'
}
}
}
stage('Frontend Build') {
steps {
dir('NEW/frontend') {
sh 'pnpm install --frozen-lockfile'
sh 'pnpm build'
}
}
}
stage('Docker Build & Push') {
parallel {
stage('Backend Image') {
steps {
dir('NEW/backend') {
sh """
docker build -t ${IMAGE_BACKEND}:${IMAGE_TAG} -t ${IMAGE_BACKEND}:latest .
docker push ${IMAGE_BACKEND}:${IMAGE_TAG}
docker push ${IMAGE_BACKEND}:latest
"""
}
}
}
stage('Frontend Image') {
steps {
dir('NEW/frontend') {
sh """
docker build -t ${IMAGE_FRONTEND}:${IMAGE_TAG} -t ${IMAGE_FRONTEND}:latest .
docker push ${IMAGE_FRONTEND}:${IMAGE_TAG}
docker push ${IMAGE_FRONTEND}:latest
"""
}
}
}
}
}
stage('Deploy') {
when {
branch 'main'
}
steps {
dir('NEW') {
sh """
docker-compose pull
docker-compose up -d --no-build
docker-compose ps
"""
}
}
}
}
post {
success {
echo "Build ${IMAGE_TAG} deployed successfully."
}
failure {
echo "Build failed. Check logs."
}
always {
sh 'docker system prune -f --filter "until=24h" || true'
}
}
}