-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
57 lines (52 loc) · 1.41 KB
/
.gitlab-ci.yml
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
cache:
paths:
- node_modules/
stages:
- test
- build
- deploy
test_application:
image: node:4.2.2
stage: test
tags:
- docker
script:
- npm install
- npm test
build_app:
stage: build
tags:
- sh
script:
- echo "Building application..."
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN gitlab-stage.cee.redhat.com:4567
- docker build -t gitlab-stage.cee.redhat.com:4567/savsingh/nodejs .
- docker push gitlab-stage.cee.redhat.com:4567/savsingh/nodejs
staging:
stage: deploy
tags:
- sh
script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN gitlab-stage.cee.redhat.com:4567
- docker pull gitlab-stage.cee.redhat.com:4567/savsingh/nodejs
- docker stop nodejs-stage || true && docker rm nodejs-stage || true
- docker run --name=nodejs-stage -p 8081:8080 -itd gitlab-stage.cee.redhat.com:4567/savsingh/nodejs:latest
except:
- master
environment:
name: staging
url: http://10.65.8.23:8081
production:
stage: deploy
tags:
- sh
script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN gitlab-stage.cee.redhat.com:4567
- docker pull gitlab-stage.cee.redhat.com:4567/savsingh/nodejs
- docker stop nodejs || true && docker rm nodejs || true
- docker run --name=nodejs -p 8080:8080 -itd gitlab-stage.cee.redhat.com:4567/savsingh/nodejs:latest
only:
- master
environment:
name: production
url: http://10.65.8.23:8080