-
Notifications
You must be signed in to change notification settings - Fork 3
/
Jenkinsfile
28 lines (26 loc) · 916 Bytes
/
Jenkinsfile
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
pipeline {
agent any
environment {
DOCKER_USERNAME = credentials('jenkins-docker-secret-username')
DOCKER_PASSWORD = credentials('jenkins-docker-secret-password')
DOCKER_REGISTRY = 'ec2-52-81-55-170.cn-north-1.compute.amazonaws.com.cn:30500'
}
stages {
stage('build') {
steps {
sh './gradlew clean build'
}
}
stage('push-image') {
steps {
sh '''
BUILD_VERSION_NUMBER=0.1.1
./gradlew jibDockerBuild
docker tag net.thoughtworks/example-product-service:latest $DOCKER_REGISTRY/example-product-service:$BUILD_VERSION_NUMBER
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD'
docker push $DOCKER_REGISTRY/example-product-service:$BUILD_VERSION_NUMBER
'''
}
}
}
}