-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
48 lines (43 loc) · 1.88 KB
/
.gitlab-ci.yml
File metadata and controls
48 lines (43 loc) · 1.88 KB
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
image: tmaier/docker-compose:latest
stages:
- build
- test
- deploy
services:
- docker:dind
buildJob:
stage: build
tags:
- docker
script:
- docker-compose -f docker-compose.ci.yml build
- apk update && apk add git
- echo $REGISTRY_PASS | docker login registry.gitlab.com -u $REGISTRY_USER --password-stdin
- docker-compose -f docker-compose.ci.yml push
- git checkout production
- git fetch
- docker-compose -f docker-compose.ci.prod.yml build
- docker-compose -f docker-compose.ci.prod.yml push
testJob:
stage: test
tags:
- docker
script:
- docker-compose -f docker-compose.ci.yml pull
- docker-compose -f docker-compose.ci.yml run --rm app-test
deployJob:
stage: deploy
only:
- production
tags:
- docker
script:
- apk add --no-cache openssh
- apk add --no-cache openssh-client
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- ssh-keyscan -H 'limelightapp.ml' >> ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
- ssh -v ci@limelightapp.ml "rm -rf limelight_api && git clone git@gitlab.com:mirandajyothy/limelight_api.git && cp .env limelight_api/.env && cd limelight_api && docker-compose -f docker-compose.deploy.yml pull && docker-compose -f docker-compose.deploy.yml up -d app" || ssh -v ci@limelightapp.ml "rm -rf limelight_api && git clone git@gitlab.com:mirandajyothy/limelight_api.git && cp .env limelight_api/.env && cd limelight_api && docker-compose -f docker-compose.deploy.yml pull && docker-compose -f docker-compose.deploy.yml up -d app" || ssh -v ci@limelightapp.ml "rm -rf limelight_api && git clone git@gitlab.com:mirandajyothy/limelight_api.git && cp .env limelight_api/.env && cd limelight_api && docker-compose -f docker-compose.deploy.yml pull && docker-compose -f docker-compose.deploy.yml up -d app"