-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathJenkinsfile.Deactivate
54 lines (45 loc) · 1.57 KB
/
Jenkinsfile.Deactivate
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
52
53
54
pipeline {
agent {
node {
label 'docker_in_docker'
}
}
environment {
SW_VERSION = '12.2.1.4'
SW_FILE1 = 'jdev_suite_122140.jar'
SW_FILE2 = 'jdev_suite_1221402.jar'
SW_DIR = '/software/Oracle/JDeveloper'
}
options {
buildDiscarder logRotator(numToKeepStr: '1')
}
stages {
stage('Build Oracle SQL JDeveloper Image') {
steps {
sh 'if [ ! -f $SW_FILE1 ]; then cp "$SW_DIR/$SW_FILE1" $SW_FILE1; fi'
sh 'if [ ! -f $SW_FILE2 ]; then cp "$SW_DIR/$SW_FILE2" $SW_FILE2; fi'
sh 'if [ ! -f silent.rsp ]; then cp "silent.rsp" silent.rsp; fi'
sh 'if [ ! -f create_inventory.sh ]; then cp "create_inventory.sh" create_inventory.sh; fi'
withCredentials([usernamePassword(credentialsId: 'docker_hub_id', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) {
sh '''
export DOCKER_BUILDKIT=1
docker login --username $USERNAME --password $PASSWORD
docker build --progress=plain --tag oracle/jdeveloper:$SW_VERSION --build-arg SW_FILE1=$SW_FILE1 --build-arg SW_FILE2=$SW_FILE2 .
'''
}
}
}
stage('Push Docker Image to Local Registry') {
steps {
sh 'docker tag oracle/jdeveloper:$SW_VERSION localhost:5000/oracle/jdeveloper:$SW_VERSION'
sh 'docker push localhost:5000/oracle/jdeveloper:$SW_VERSION'
}
}
stage('Cleanup') {
steps {
sh 'docker rmi --force localhost:5000/oracle/jdeveloper:$SW_VERSION'
sh 'docker rmi --force oracle/jdeveloper:$SW_VERSION'
}
}
}
}