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