-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
30 lines (26 loc) · 993 Bytes
/
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
node('infrastructure') {
ansiColor('xterm') {
stage('Checkout') {
env.GIT_COMMIT_HASH = checkout(scm).GIT_COMMIT
}
dir('src/docker/jenkins/master') {
stage('Jenkins Master Build') {
buildAndPushDocker("scos/jenkins-master", "Dockerfile")
}
}
dir('src/docker/jenkins_workers') {
stage('Jenkins Workers Build - Infrastructure') {
buildAndPushDocker("scos/jenkins-worker-infrastructure", "Dockerfile.infrastructure")
}
}
}
}
def buildAndPushDocker(imageName, dockerFilePath) {
def image = docker.build("${imageName}:${env.GIT_COMMIT_HASH}", "-f ${dockerFilePath} --build-arg docker_config=/etc/docker .")
if (env.BRANCH_NAME == 'master') {
docker.withRegistry("https://199837183662.dkr.ecr.us-east-2.amazonaws.com", "ecr:us-east-2:aws_jenkins_user") {
image.push()
image.push('latest')
}
}
}