-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
65 lines (59 loc) · 1.38 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
pipeline {
agent any
stages {
stage('Instalamos dependencias') {
steps {
sh ''' echo "Instalamos dependencias"
npm i
'''
}
}
stage('Compilamos') {
steps {
sh '''
echo "Compilamos "
npm run build
'''
}
}
stage('Construimos la imagen docker') {
when{
branch 'Produccion'
}
steps {
sh '''
pwd
ls -la
docker build -t auth-node .
'''
}
}
stage('Deploying image docker'){
when{
branch 'Produccion'
}
steps {
sh '''
docker stop auth
docker container rm auth
docker run -d --name auth -v /jenkinsCredentials/.env:/usr/src/node/.env --network host auth-node
'''
}
}
stage('Deploying to docker hub'){
when{
branch 'Produccion'
}
steps {
sh '''
echo "subimos a docker hub"
docker tag auth-node tresee/auth-node:latest
docker login --username=tresee -p TresEDevs!1
docker push tresee/auth-node
docker tag auth-node docker.tresee.app/auth-node:latest
docker push docker.tresee.app/auth-node
'''
}
}
}
}