-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
46 lines (41 loc) · 1.28 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
image: tmaier/docker-compose:latest
stages:
- test
- deploy
services:
- docker:dind
before_script:
- docker info
- docker-compose --version
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
test:
stage: test
tags:
- docker
script:
- docker-compose -f docker-compose.tests.yml up -d
- sleep 15
- docker-compose exec -T backend python manage.py migrate
- docker-compose exec -T backend pytest -p no:warnings --cov=. --cov-report html
- docker-compose exec -T backend coverage report --precision=2
deploy:
stage: deploy
tags:
- docker
script:
- docker-compose push
- chmod og= $ID_RSA
- ssh -i $ID_RSA -o StrictHostKeyChecking=no $SERVER_USER@$SERVER_IP -p $SERVER_SSH_PORT
"cd UMCS-lights &&
git pull &&
git checkout development &&
docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY &&
docker-compose pull &&
docker-compose -f docker-compose.prod.yml stop &&
docker-compose -f docker-compose.prod.yml up --build -d &&
sleep 15 &&
docker-compose -f docker-compose.prod.yml exec -T backend python manage.py migrate &&
docker-compose -f docker-compose.prod.yml exec -T backend python manage.py collectstatic --no-input"
only:
- main
- development