java-spring-microservice/Jenkinsfile
Jim Nicholson bb02557dda
Some checks reported errors
Homelab/java-spring-microservice/pipeline/head Something is wrong with the build of this commit
Build with Kaniko
2021-12-22 17:38:24 -08:00

38 lines
907 B
Groovy

def label = "mypod-${UUID.randomUUID().toString()}"
podTemplate(label: label, containers: [
containerTemplate(
name: 'maven',
image: 'maven:3.8.4-openjdk-11',
command: 'sleep',
args: '30d'
),
containerTemplate(
name: 'kaniko',
image: 'gcr.io/kaniko-project/executor:latest',
command: 'sleep',
args: '99d'
)
]) {
node(label) {
stage('Checkout') {
checkout scm
container('maven') {
stage('Build') {
sh '''
mvn clean package
'''
}
stage('Archive') {
archiveArtifacts artifacts: 'target/*.jar', followSymlinks: false
}
}
container('kaniko') {
stage('Image') {
sh '/kaniko/executor -f `pwd`/Dockerfile -c `pwd` --insecure --skip-tls-verify --cache-true --destination=docker.thejimnicholson.com/servicedemo/test:latest'
}
}
}
}
}