1 |
d35ff36f
|
vastja
|
image: php:7.2-alpine
|
2 |
27460050
|
vastja
|
|
3 |
1e8e5bc0
|
vastja
|
variables:
|
4 |
|
|
IMAGE_NAME: zcu-campus-life-app:$CI_COMMIT_REF_NAME
|
5 |
|
|
|
6 |
27460050
|
vastja
|
stages:
|
7 |
|
|
- test
|
8 |
1e8e5bc0
|
vastja
|
- build
|
9 |
27460050
|
vastja
|
|
10 |
|
|
before_script:
|
11 |
d35ff36f
|
vastja
|
- apk update
|
12 |
|
|
- apk upgrade
|
13 |
1e8e5bc0
|
vastja
|
# Setup SSH deploy keys
|
14 |
1783ec87
|
vastja
|
- 'which ssh-agent || ( apk add -qq openssh-client )'
|
15 |
1e8e5bc0
|
vastja
|
- eval $(ssh-agent -s)
|
16 |
5bed06b0
|
vastja
|
- "#!/bin/sh -c 'ssh-add <(echo \"$SSH_PRIVATE_KEY\")'"
|
17 |
1e8e5bc0
|
vastja
|
- mkdir -p ~/.ssh
|
18 |
1783ec87
|
vastja
|
- '[[ -f /.dockerenv ]] & echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
|
19 |
27460050
|
vastja
|
|
20 |
|
|
unit_tests:
|
21 |
|
|
stage: test
|
22 |
|
|
script:
|
23 |
59edbad2
|
vastja
|
- apk add composer
|
24 |
27460050
|
vastja
|
- cd website
|
25 |
59edbad2
|
vastja
|
- composer require --dev symfony/phpunit-bridge
|
26 |
1e8e5bc0
|
vastja
|
- php bin/phpunit
|
27 |
|
|
|
28 |
|
|
build:
|
29 |
|
|
stage: build
|
30 |
|
|
script:
|
31 |
|
|
# - docker login -u $USER p $PASSWORD gitlab.kiv.zcu.cz:5000
|
32 |
|
|
# Todo propagate image name into docker-compose.yml
|
33 |
de206243
|
vastja
|
- docker-compose build
|
34 |
1e8e5bc0
|
vastja
|
# - docker-compose push $IMAGE_NAME
|
35 |
|
|
|
36 |
|
|
# deploy_prod:
|
37 |
|
|
# stage: deploy
|
38 |
|
|
# environmnet:
|
39 |
|
|
# name: deploy
|
40 |
|
|
# url: http://whatever.zcu.cz
|
41 |
|
|
# script:
|
42 |
|
|
# - ssh root@example.com "docker login -u $USER p $PASSWORD gitlab.kiv.zcu.cz:5000 && docker-compose pull $IMAGE_NAME && docker-compose up"
|
43 |
|
|
# only:
|
44 |
|
|
# - master
|
45 |
|
|
# when: manual
|