-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfile-local
51 lines (44 loc) · 1.39 KB
/
Jenkinsfile-local
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
pipeline {
agent any
stages {
stage('Prepare Environment') {
steps {
script {
// Docker 데몬이 실행 중인지 확인
def dockerStatus = sh(script: 'docker info >/dev/null 2>&1 && echo "Running" || echo "Not running"', returnStatus: true)
// Docker 데몬이 실행 중이지 않으면 시작
if (dockerStatus != 0) {
error 'Docker daemon is not running or accessible.'
}
}
}
}
stage('Clone Repository') {
steps {
script {
git branch: 'main', credentialsId: 'github-jenkins', url: 'https://github.com/Food-GO/FoodGo-BE.git'
}
}
}
stage('Gradle Build') {
steps {
dir('api-module') {
sh 'ls'
sh 'ls ..'
sh 'chmod +x ../gradlew'
sh '../gradlew build'
}
}
}
stage('Build Docker Image') {
steps {
sh 'docker build -t anjeonghoo/food_go .'
}
}
stage('Run Docker Container Locally') {
steps {
sh 'docker run -d -p 9090:8080 anjeonghoo/food_go'
}
}
}
}