forked from gustavoapolinario/node-todo-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
36 lines (31 loc) · 825 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
31
32
33
34
35
36
node {
env.AWS_ECR_LOGIN=true
def newApp
def registry = 'gustavoapolinario/microservices-node-todo-frontend'
def registryCredential = 'dockerhub'
stage('Git') {
git 'https://github.com/gustavoapolinario/node-todo-frontend'
}
stage('Build') {
sh 'npm install'
}
stage('Test') {
sh 'npm test'
}
stage('Building image') {
docker.withRegistry( 'https://' + registry, registryCredential ) {
def buildName = registry + ":$BUILD_NUMBER"
newApp = docker.build buildName
newApp.push()
}
}
stage('Registring image') {
docker.withRegistry( 'https://' + registry, registryCredential ) {
newApp.push 'latest2'
}
}
stage('Removing image') {
sh "docker rmi $registry:$BUILD_NUMBER"
sh "docker rmi $registry:latest"
}
}