-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
26 lines (26 loc) · 1.05 KB
/
Jenkinsfile
File metadata and controls
26 lines (26 loc) · 1.05 KB
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
pipeline {
agent any
tools {
jfrog 'jfrog-cli'
}
stages {
stage('Build') {
steps {
// git url: 'https://github.com/gmdavef/container-java-hello-world', branch: 'main'
sh 'javac HelloWorld.java'
sh 'docker build --tag ${ARTIFACTORY_SERVER}:${ARTIFACTORY_PORT}/docker-local/cicd-builds/java-hello-world:${BUILD_NUMBER} .'
sh 'docker images'
}
}
stage('Push') {
steps {
// Check our Artifactory config
jf 'c show'
// Push our built image into Artifactory using the "jwt" server config
jf 'docker push ${ARTIFACTORY_SERVER}:${ARTIFACTORY_PORT}/docker-local/cicd-builds/java-hello-world:${BUILD_NUMBER} --server-id ${ARTIFACTORY_SERVER}-jwt'
// Remove the local image to keep things tidy
sh 'docker rmi ${ARTIFACTORY_SERVER}:${ARTIFACTORY_PORT}/docker-local/cicd-builds/java-hello-world:${BUILD_NUMBER}'
}
}
}
}