forked from Camus-chat/backend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
31 lines (30 loc) · 1.18 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
pipeline {
agent any
stages {
stage('ECR Upload') {
steps{
dir('./backend') {
withCredentials([file(credentialsId: 'APPLICATION_YML', variable: 'APPLICATION_YML')]) {
script {
sh 'rm -rf src/main/resources'
sh 'mkdir src/main/resources'
sh 'cp ${APPLICATION_YML} src/main/resources/'
}
}
sh 'aws ecr get-login-password --region ap-northeast-2 | docker login --username AWS --password-stdin ${ECR_REPOSITORY_URI}'
sh 'docker build -t ${DOCKER_IMAGE_NAME} .'
sh 'docker tag ${DOCKER_IMAGE_NAME}:latest ${ECR_REPOSITORY_URI}/${DOCKER_IMAGE_NAME}:latest'
sh 'docker push ${ECR_REPOSITORY_URI}/${DOCKER_IMAGE_NAME}:latest'
}
}
post {
success {
echo "The ECR Upload stage successfully."
}
failure {
echo "The ECR Upload stage failed."
}
}
}
}
}