Actualiser Jenkinsfile
This commit is contained in:
parent
09cc1633cc
commit
e8a80a2dde
12
Jenkinsfile
vendored
12
Jenkinsfile
vendored
@ -6,7 +6,9 @@ pipeline {
|
||||
|
||||
environment {
|
||||
SERVICE_NAME = 'AutoDeploy'
|
||||
DOCKER_REGISTRY_URL = 'gitea.firewax.fr/corenthin/autodeploy:latest'
|
||||
DOCKER_REGISTRY_URL = 'http://172.75.13.27:3000/corenthin/autodeploy:latest'
|
||||
DOCKER_TAG = '172.75.13.27:3000/corenthin/autodeploy:latest'
|
||||
|
||||
DEPLOY_HOST = '172.75.13.5'
|
||||
DEPLOY_CREDENTIALS_ID = '1000'
|
||||
}
|
||||
@ -22,7 +24,7 @@ pipeline {
|
||||
steps {
|
||||
script {
|
||||
def shortCommit = sh(returnStdout: true, script: 'git rev-parse --short HEAD').trim()
|
||||
env.IMAGE_TAG = "${env.DOCKER_REGISTRY_URL}"
|
||||
env.IMAGE_TAG = "${env.DOCKER_TAG}"
|
||||
|
||||
echo "Construction de l'image Docker avec le tag : ${env.IMAGE_TAG}"
|
||||
sh "docker build -t ${env.IMAGE_TAG} ."
|
||||
@ -33,7 +35,11 @@ pipeline {
|
||||
stage('Push Docker Image') {
|
||||
steps {
|
||||
withCredentials([usernamePassword(credentialsId: 'docker-registry-credentials', passwordVariable: 'DOCKER_PASSWORD', usernameVariable: 'DOCKER_USERNAME')]) {
|
||||
sh "echo \$DOCKER_PASSWORD | docker login -u \$DOCKER_USERNAME --password-stdin ${env.DOCKER_REGISTRY_URL.substring(0, env.DOCKER_REGISTRY_URL.indexOf('/'))}"
|
||||
script {
|
||||
def registryHostPort = env.DOCKER_REGISTRY_URL.split('//')[1].split('/')[0]
|
||||
sh "echo \$DOCKER_PASSWORD | docker login -u \$DOCKER_USERNAME --password-stdin 172.75.13.27:3000"
|
||||
}
|
||||
|
||||
|
||||
sh "docker push ${env.IMAGE_TAG}"
|
||||
sh "docker rmi ${env.IMAGE_TAG}"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user