forked from CityOfZion/neo-scan
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
58 lines (53 loc) · 1.59 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
58
stages:
- build
- deploy
before_script:
- export IMAGE_TAG="$CI_PIPELINE_ID-$CI_COMMIT_REF_SLUG"
- export REGISTRY_PATH="$CI_REGISTRY_IMAGE:$IMAGE_TAG"
- export HAPROXY_REGISTRY_PATH="$CI_REGISTRY_IMAGE/haproxy:$IMAGE_TAG"
neoscan-build:
stage: build
image: docker:latest
services:
- docker:dind
script:
- docker login -u gitlab-ci-token -p "$CI_JOB_TOKEN" $CI_REGISTRY
- docker build -t $REGISTRY_PATH .
- docker login -u gitlab-ci-token -p "$CI_JOB_TOKEN" $CI_REGISTRY
- docker push $REGISTRY_PATH
- "[ \"$CI_COMMIT_REF_SLUG\" == \"master\" ] && docker tag $REGISTRY_PATH $CI_REGISTRY_IMAGE || true"
- "[ \"$CI_COMMIT_REF_SLUG\" == \"master\" ] && docker push $CI_REGISTRY_IMAGE || true"
haproxy-build:
stage: build
image: docker:latest
services:
- docker:dind
script:
- docker login -u gitlab-ci-token -p "$CI_JOB_TOKEN" $CI_REGISTRY
- cd haproxy && docker build -t $HAPROXY_REGISTRY_PATH .
- docker login -u gitlab-ci-token -p "$CI_JOB_TOKEN" $CI_REGISTRY
- docker push $HAPROXY_REGISTRY_PATH
staging:
stage: deploy
environment: staging
script:
- docker login -u gitlab-ci-token -p "$CI_JOB_TOKEN" $CI_REGISTRY
- docker-compose -f docker-compose.prod.yml up -d
variables:
HOST: neoscan.backslash.fr
tags:
- staging
when: manual
production:
stage: deploy
environment: production
script:
- docker login -u gitlab-ci-token -p "$CI_JOB_TOKEN" $CI_REGISTRY
- docker-compose -f docker-compose.prod.yml up -d
variables:
HOST: api.neoscan.io
tags:
- production
when: manual
only:
- master