Jenkinsfile: add CI Docker image build for Jenkins

We'll use `deploy-${env}-${stage}` tags for deploy to Spiff envs.

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2023-02-23 10:58:24 +01:00
parent 74f85cac50
commit 825804de00
No known key found for this signature in database
GPG Key ID: FE65CD384D5BF7B4
1 changed files with 48 additions and 0 deletions

48
Jenkinsfile vendored Normal file
View File

@ -0,0 +1,48 @@
pipeline {
agent { label 'linux' }
options {
timestamps()
timeout(time: 20, unit: 'MINUTES')
buildDiscarder(logRotator(
numToKeepStr: '10',
daysToKeepStr: '30',
))
}
parameters {
choice(
name: 'IMAGE_TAG',
description: 'Name of Docker tag to push. Chose wisely.',
choices: ['latest', 'deploy-app-dev', 'deploy-mod-dev', 'deploy-app-test', 'deploy-mod-test'],
)
string(
name: 'IMAGE_NAME',
description: 'Name of Docker image to push.',
defaultValue: params.IMAGE_NAME ?: 'statusteam/spiffworkflow-connector',
)
}
stages {
stage('Build') {
steps { script {
image = docker.build(
"${params.IMAGE_NAME}:${env.GIT_COMMIT.take(8)}",
"--label=commit='${env.GIT_COMMIT.take(8)}' ."
)
} }
}
stage('Push') {
steps { script {
withDockerRegistry([credentialsId: "dockerhub-statusteam-auto", url: ""]) {
image.push()
image.push(env.IMAGE_TAG)
}
} }
}
} // stages
post {
always { sh 'docker image prune -f' }
} // post
} // pipeline