pushing python project
This commit is contained in:
35
Jenkinsfile-push-gitea-dockerhub
Normal file
35
Jenkinsfile-push-gitea-dockerhub
Normal file
@@ -0,0 +1,35 @@
|
||||
pipeline {
|
||||
agent any
|
||||
|
||||
environment {
|
||||
DOCKERHUB_REPO = 'jacqueskingram/python-jenkins-project'
|
||||
GITEA_REPO = 'code.jacquesingram.online/lenape/python-jenkins-project.git'
|
||||
}
|
||||
|
||||
stages {
|
||||
stage('Build Docker Image') {
|
||||
steps {
|
||||
script {
|
||||
def imageName = "${env.DOCKERHUB_REPO}:${BUILD_NUMBER}"
|
||||
docker.build(imageName, '.')
|
||||
env.IMAGE_NAME = imageName
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Push to Gitea') {
|
||||
steps {
|
||||
git credentialsId: 'my-gitea-credentials', url: "${env.GITEA_REPO}"
|
||||
sh 'git push origin main'
|
||||
}
|
||||
}
|
||||
stage('Push to Docker Hub') {
|
||||
steps {
|
||||
script {
|
||||
docker.withRegistry('https://index.docker.io/v1/', 'my-dockerhub-credentials') {
|
||||
docker.image(env.IMAGE_NAME).push()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user