-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathJenkinsfile
More file actions
32 lines (32 loc) · 1.03 KB
/
Jenkinsfile
File metadata and controls
32 lines (32 loc) · 1.03 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
27
28
29
30
31
32
node {
checkout scm
def app
def dockerImage = docker.build("buildprocess/docker", "./JenkinsCI-Docker/docker/")
withEnv([
'DOCKER_ACCOUNT=firestarthehack',
'IMAGE_VERSION=1.01',
'IMAGE_NAME=videoconverter'
]){
stage('Build') {
dockerImage.inside{
sh 'rm -rf dockerbuild/'
sh 'chmod 0755 ./gradlew;./gradlew clean build --refresh-dependencies'
}
}
stage('Docker Build') {
sh "mkdir dockerbuild/"
sh 'cp build/libs/*.jar dockerbuild/app.jar && cp Dockerfile dockerbuild/Dockerfile'
app = docker.build("${env.DOCKER_ACCOUNT}/${env.IMAGE_NAME}", "./dockerbuild/")
archiveArtifacts(artifacts: 'build/libs/*.jar', onlyIfSuccessful: true)
}
stage('Test image') {
app.inside {
sh 'echo "Tests passed"'
}
}
stage('Publish Latest Image') {
app.push("${env.IMAGE_VERSION}")
app.push("latest")
}
}
}