You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1.1 KiB
38 lines
1.1 KiB
pipeline { |
|
agent any |
|
|
|
environment { |
|
DOCKERHUB_REPO = 'jacqueskingram/python-jenkins-project' |
|
GITEA_REPO = 'https://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 checkout -b master |
|
git push origin master |
|
''' |
|
} |
|
} |
|
stage('Push to Docker Hub') { |
|
steps { |
|
script { |
|
docker.withRegistry('https://index.docker.io/v1/', 'my-dockerhub-credentials') { |
|
docker.image(env.IMAGE_NAME).push() |
|
} |
|
} |
|
} |
|
} |
|
} |
|
}
|
|
|