-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathJenkinsfile
More file actions
48 lines (45 loc) · 1.08 KB
/
Jenkinsfile
File metadata and controls
48 lines (45 loc) · 1.08 KB
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
pipeline {
agent any
environment
{
VERSION = "${BUILD_NUMBER}"
PROJECT = 'nodeapp'
IMAGE = "$PROJECT:$VERSION"
ECRURL = 'https://040200806866.dkr.ecr.ap-south-1.amazonaws.com'
ECRCRED = 'ecr:ap-south-1:awscredentials'
}
stages {
stage('GetSCM') {
steps {
// Get some code from a GitHub repository
git 'https://github.com/jmstechhome/nodejsapp.git'
}
}
stage('Image Build'){
steps{
script{
docker.build('$IMAGE')
}
}
}
stage('Push Image'){
steps{
script
{
docker.withRegistry(ECRURL, ECRCRED)
{
docker.image(IMAGE).push()
}
}
}
}
}
post
{
always
{
// make sure that the Docker image is removed
sh "docker rmi $IMAGE | true"
}
}
}