add ecr repo stage
This commit is contained in:
12
Jenkinsfile
vendored
12
Jenkinsfile
vendored
@@ -5,6 +5,10 @@ pipeline {
|
||||
tools {
|
||||
maven 'Maven'
|
||||
}
|
||||
environment {
|
||||
DOCKER_REPO_SERVER = '664574038682.dkr.ecr.eu-west-3.amazonaws.com'
|
||||
DOCKER_REPO = "${DOCKER_REPO_SERVER}/java-maven-app"
|
||||
}
|
||||
stages {
|
||||
stage('increment version') {
|
||||
steps {
|
||||
@@ -31,10 +35,10 @@ pipeline {
|
||||
steps {
|
||||
script {
|
||||
echo "building the docker image..."
|
||||
withCredentials([usernamePassword(credentialsId: 'docker-hub-repo', passwordVariable: 'PASS', usernameVariable: 'USER')]) {
|
||||
sh "docker build -t nanajanashia/demo-app:${IMAGE_NAME} ."
|
||||
sh "echo $PASS | docker login -u $USER --password-stdin"
|
||||
sh "docker push nanajanashia/demo-app:${IMAGE_NAME}"
|
||||
withCredentials([usernamePassword(credentialsId: 'ecr-credentials', passwordVariable: 'PASS', usernameVariable: 'USER')]) {
|
||||
sh "docker build -t ${DOCKER_REPO}:${IMAGE_NAME} ."
|
||||
sh "echo $PASS | docker login -u $USER --password-stdin ${DOCKER_REPO_SERVER}"
|
||||
sh "docker push ${DOCKER_REPO}:${IMAGE_NAME}"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user