Build docker image and push it to registry
Some checks failed
Amarillo/amarillo-gitea/amarillo-core/pipeline/head There was a failure building this commit

This commit is contained in:
Csaba 2023-12-20 12:02:56 +01:00
parent 5a2ad2f119
commit 7b53fb1479

20
Jenkinsfile vendored
View file

@ -8,6 +8,10 @@ pipeline {
environment {
GITEA_CREDS = credentials('AMARILLO-JENKINS-GITEA-USER')
TWINE_REPO_URL = "https://git.gerhardt.io/api/packages/amarillo/pypi"
REGISTRY_URL = 'git.gerhardt.io'
OWNER = 'amarillo'
IMAGE_NAME = "amarillo"
TAG = 'latest'
}
stages {
stage('Create virtual environment') {
@ -31,7 +35,7 @@ pipeline {
echo 'Testing'
}
}
stage('Build') {
stage('Build package') {
steps {
echo 'Building package'
sh 'python -m build'
@ -42,6 +46,20 @@ pipeline {
sh 'python -m twine upload --skip-existing --verbose --repository-url $TWINE_REPO_URL --username $GITEA_CREDS_USR --password $GITEA_CREDS_PSW ./dist/*'
}
}
stage('Build docker image') {
steps {
echo 'Building image'
docker.build("${OWNER}/${IMAGE_NAME}:${TAG}")
}
}
stage('Push image to container registry') {
steps {
echo 'Pushing image to registry'
docker.withRegistry(REGISTRY_URL, GITEA_CREDS){
docker.image("${OWNER}/${IMAGE_NAME}:${TAG}").push()
}
}
}
}
post {
always {