Updated Jenkinsfile to build docker container
All checks were successful
Amarillo/amarillo-gitea/amarillo-enhancer/pipeline/head This commit looks good
All checks were successful
Amarillo/amarillo-gitea/amarillo-enhancer/pipeline/head This commit looks good
This commit is contained in:
parent
6dba68f7d8
commit
dda4cb40e0
31
Jenkinsfile
vendored
31
Jenkinsfile
vendored
|
|
@ -4,6 +4,11 @@ pipeline {
|
|||
GITEA_CREDS = credentials('AMARILLO-JENKINS-GITEA-USER')
|
||||
PYPI_CREDS = credentials('AMARILLO-JENKINS-PYPI-USER')
|
||||
TWINE_REPO_URL = "https://git.gerhardt.io/api/packages/amarillo/pypi"
|
||||
DOCKER_REGISTRY_URL = 'https://git.gerhardt.io'
|
||||
OWNER = 'amarillo'
|
||||
IMAGE_NAME = 'amarillo-enhancer'
|
||||
DISTRIBUTION = '0.2'
|
||||
TAG = "${DISTRIBUTION}.${BUILD_NUMBER}"
|
||||
}
|
||||
stages {
|
||||
stage('Create virtual environment') {
|
||||
|
|
@ -44,5 +49,31 @@ pipeline {
|
|||
sh 'python3 -m twine upload --verbose --username $PYPI_CREDS_USR --password $PYPI_CREDS_PSW ./dist/*'
|
||||
}
|
||||
}
|
||||
stage('Build docker image') {
|
||||
when {
|
||||
branch 'main'
|
||||
}
|
||||
steps {
|
||||
echo 'Building image'
|
||||
script {
|
||||
docker.build("${OWNER}/${IMAGE_NAME}:${TAG}")
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Push image to container registry') {
|
||||
when {
|
||||
branch 'main'
|
||||
}
|
||||
steps {
|
||||
echo 'Pushing image to registry'
|
||||
script {
|
||||
docker.withRegistry(DOCKER_REGISTRY_URL, 'AMARILLO-JENKINS-GITEA-USER'){
|
||||
def image = docker.image("${OWNER}/${IMAGE_NAME}:${TAG}")
|
||||
image.push()
|
||||
image.push('latest')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue