-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
62 lines (56 loc) · 1.31 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
image: docker
stages:
- build
- lint
- test
- clean
- deploy
build:
stage: build
before_script:
- apk update && apk add docker-compose && apk add make
script:
- make docker-build
lint:
stage: lint
before_script:
- apk update && apk add make
script:
- make lint-ci
dependencies:
- build
test:
stage: test
before_script:
- apk update && apk add make
script:
- make test-ci
dependencies:
- build
clean:
stage: clean
except:
- main
before_script:
- apk update && apk add make
script:
- make clean-ci
deploy:
stage: deploy
only:
- main
before_script:
- 'command -v ssh-agent >/dev/null || ( apk add --update openssh )'
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- ssh-keyscan $VM_HOSTNAME >> ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
script:
- docker save -o cis3760-react.tar cis3760-react
- docker save -o cis3760-api.tar cis3760-api
- ssh rowak@$VM_HOSTNAME "sudo rm -rdf ~/temp"
- scp cis3760-*.tar rowak@$VM_HOSTNAME:~/temp
- scp -r . rowak@$VM_HOSTNAME:~/temp
- ssh rowak@$VM_HOSTNAME "cd ~/temp && sudo docker load -i cis3760-react.tar && sudo docker load -i cis3760-api.tar && sudo docker-compose up -d"