-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.gitlab-ci.yml
73 lines (67 loc) · 2.49 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
stages:
- release
- deploy-production
before_script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
variables:
CONTAINER_RELEASE_IMAGE: $CI_REGISTRY_IMAGE:latest
release:
stage: release
script:
- chmod +x create_env.sh
- "sh ./create_env.sh"
- docker build --pull -t $CONTAINER_RELEASE_IMAGE ./ -f ./Dockerfile.release
- docker push $CONTAINER_RELEASE_IMAGE
only:
- develop
- master
tags:
- build #shared runner on shared machine
deploy-production-de:
stage: deploy-production
only:
- master
script:
- docker pull $CONTAINER_RELEASE_IMAGE
- chmod +x dbauth.sh
- "sh ./dbauth.sh"
- docker-compose -f docker-compose.production.yml up -d postgres
- docker-compose -f docker-compose.production.yml exec -d postgres sh /usr/bin/setpw.sh
- sleep 10 #make sure postgres container is ready
- docker-compose -f docker-compose.production.yml run --rm rails bundle exec rake db:create
- docker-compose -f docker-compose.production.yml run --rm rails bundle exec rake db:migrate
- docker-compose -f docker-compose.production.yml up -d rails
tags:
- production-do-de-1
deploy-production-us:
stage: deploy-production
only:
- master
script:
- docker pull $CONTAINER_RELEASE_IMAGE
- chmod +x dbauth.sh
- "sh ./dbauth.sh"
- docker-compose -f docker-compose.production.yml up -d postgres
- docker-compose -f docker-compose.production.yml exec -d postgres sh /usr/bin/setpw.sh
- sleep 10 #make sure postgres container is ready
- docker-compose -f docker-compose.production.yml run --rm rails bundle exec rake db:create
- docker-compose -f docker-compose.production.yml run --rm rails bundle exec rake db:migrate
- docker-compose -f docker-compose.production.yml up -d rails
tags:
- production-do-us-1
deploy-production-singapore-1:
stage: deploy-production
only:
- master
script:
- docker pull $CONTAINER_RELEASE_IMAGE
- chmod +x dbauth.sh
- "sh ./dbauth.sh"
- docker-compose -f docker-compose.production.yml up -d postgres
- docker-compose -f docker-compose.production.yml exec -d postgres sh /usr/bin/setpw.sh
- sleep 10 #make sure postgres container is ready
- docker-compose -f docker-compose.production.yml run --rm rails bundle exec rake db:create
- docker-compose -f docker-compose.production.yml run --rm rails bundle exec rake db:migrate
- docker-compose -f docker-compose.production.yml up -d rails
tags:
- production-do-singapore-1