-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
49 lines (44 loc) · 1.44 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
pipeline {
agent {
docker {
image '009543623063.dkr.ecr.eu-west-2.amazonaws.com/jenkins-docker-ci:latest'
alwaysPull true
args '-v /var/run/docker.sock:/var/run/docker.sock'
}
}
environment {
DOCKER_REGISTRY = '009543623063.dkr.ecr.eu-west-2.amazonaws.com'
//DOCKER_IMAGE_NAME = "${env.JOB_NAME.split('/')[-2]?.replace('docker-', '')}"
DOCKER_IMAGE_NAME ="jenkins-gradle-ci"
DOCKER_TAG = "${env.BRANCH_NAME == 'master' ? 'latest' : env.BRANCH_NAME}"
DOCKER_OPTS = '--pull --compress --no-cache=true --force-rm=true --progress=plain '
DOCKER_BUILDKIT = '1'
}
triggers{
// run once a week between the hours of 1 and 6 on sunday
cron('H H(1-6) * * 0')
upstream(upstreamProjects: 'Docker/docker-jenkins-base/corretto-21')
}
options{
ansiColor('xterm')
timestamps()
buildDiscarder(logRotator(numToKeepStr: '5'))
disableConcurrentBuilds()
}
stages {
stage('build') {
steps {
sh '''
docker build ${DOCKER_OPTS} -t "${DOCKER_REGISTRY}/${DOCKER_IMAGE_NAME}:${DOCKER_TAG}" .
'''
}
}
stage('publish') {
steps {
sh '''
docker push ${DOCKER_REGISTRY}/${DOCKER_IMAGE_NAME}:${DOCKER_TAG}
'''
}
}
}
}