-
Notifications
You must be signed in to change notification settings - Fork 95
/
.gitlab-ci.yml
87 lines (80 loc) · 2.21 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
image: docker:git
services:
- docker:dind
variables:
DOCKER_NAMESPACE: registry.gitlab.com/jam-systems/jam
DEPLOYMENT_PATH: /root/jam/deployment
stages:
- build
- deploy
build-pantry:
stage: build
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build -t $DOCKER_NAMESPACE/pantry:${CI_COMMIT_REF_SLUG} pantry
- docker push $DOCKER_NAMESPACE/pantry:${CI_COMMIT_REF_SLUG}
only:
refs:
- master
- stable
changes:
- pantry/**/*
- .gitlab-ci.yml
build-sfu:
stage: build
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build -t $DOCKER_NAMESPACE/pantry-sfu:${CI_COMMIT_REF_SLUG} pantry-sfu
- docker push $DOCKER_NAMESPACE/pantry-sfu:${CI_COMMIT_REF_SLUG}
only:
refs:
- master
- stable
changes:
- pantry-sfu/**/*
- .gitlab-ci.yml
build-ui:
stage: build
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build -t $DOCKER_NAMESPACE/ui:${CI_COMMIT_REF_SLUG} ui
- docker push $DOCKER_NAMESPACE/ui:${CI_COMMIT_REF_SLUG}
only:
refs:
- master
- stable
changes:
- ui/**/*
- .gitlab-ci.yml
update-beta-server:
stage: deploy
only:
refs:
- master
variables:
GIT_STRATEGY: none
DEPLOYMENT_HOST: beta.jam.systems
script:
- eval $(ssh-agent -s)
- echo "$DEPLOY_KEY" | tr -d '\r' | ssh-add - > /dev/null
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- ssh-keyscan $DEPLOYMENT_HOST >> ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
- ssh root@$DEPLOYMENT_HOST "cd $DEPLOYMENT_PATH && git pull && docker-compose pull && docker-compose up -d && exit"
update-prod-server:
stage: deploy
only:
refs:
- stable
variables:
GIT_STRATEGY: none
DEPLOYMENT_HOST: jam.systems
script:
- eval $(ssh-agent -s)
- echo "$DEPLOY_KEY" | tr -d '\r' | ssh-add - > /dev/null
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- ssh-keyscan $DEPLOYMENT_HOST >> ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
- ssh root@$DEPLOYMENT_HOST "cd $DEPLOYMENT_PATH && git pull && docker-compose pull && docker-compose up -d && exit"