-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
98 lines (86 loc) · 3.17 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
image: docker:git
stages:
- build
before_script:
- docker login --username=$DOCKER_AUTH_USERNAME --password=$DOCKER_AUTH_PASSWORD
#-------------------------------------------------------------------------------
.php-ci-template: &php-ci-template
script:
- cd php-ci
- |
sed s/php:7.0-alpine/${PHP_IMAGE_TAG}/ Dockerfile > CurrentDockerfile
if [ -n "$PHP_XDEBUG_VERSION" ]
then
mv CurrentDockerfile OldDockerfile
sed s/pecl\ install\ xdebug/pecl\ install\ ${PHP_XDEBUG_VERSION}/ OldDockerfile > CurrentDockerfile
rm OldDockerfile
fi
- docker build -t chstudio/php-ci:${PHP_ROOT_VERSION} --file=CurrentDockerfile .
- cd ../php-ci.mysql
- sed s/php-ci:7.0/php-ci:${PHP_ROOT_VERSION}/ Dockerfile > CurrentDockerfile
- docker build -t chstudio/php-ci.mysql:${PHP_ROOT_VERSION} --file=CurrentDockerfile .
- export PHP_VERSION=`docker run chstudio/php-ci:${PHP_ROOT_VERSION} php -v | sed -n 1p | cut -d ' ' -f 2`
- docker push chstudio/php-ci:${PHP_ROOT_VERSION}
- docker push chstudio/php-ci.mysql:${PHP_ROOT_VERSION}
- |
if [[ "$PHP_ROOT_VERSION" != "latest" ]]
then
docker tag chstudio/php-ci:${PHP_ROOT_VERSION} chstudio/php-ci:$PHP_VERSION
docker push chstudio/php-ci:$PHP_VERSION
docker tag chstudio/php-ci.mysql:${PHP_ROOT_VERSION} chstudio/php-ci.mysql:$PHP_VERSION
docker push chstudio/php-ci.mysql:$PHP_VERSION
fi
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.gitlab.com
- docker tag chstudio/php-ci:${PHP_ROOT_VERSION} registry.gitlab.com/chstudio/docker-images:php-ci_${PHP_ROOT_VERSION}
- docker push registry.gitlab.com/chstudio/docker-images:php-ci_${PHP_ROOT_VERSION}
- docker tag chstudio/php-ci.mysql:${PHP_ROOT_VERSION} registry.gitlab.com/chstudio/docker-images:php-ci.mysql_${PHP_ROOT_VERSION}
- docker push registry.gitlab.com/chstudio/docker-images:php-ci.mysql_${PHP_ROOT_VERSION}
- |
if [[ "$PHP_ROOT_VERSION" != "latest" ]]
then
docker tag chstudio/php-ci:${PHP_ROOT_VERSION} registry.gitlab.com/chstudio/docker-images:php-ci_${PHP_VERSION}
docker push registry.gitlab.com/chstudio/docker-images:php-ci_${PHP_VERSION}
docker tag chstudio/php-ci.mysql:${PHP_ROOT_VERSION} registry.gitlab.com/chstudio/docker-images:php-ci.mysql_${PHP_VERSION}
docker push registry.gitlab.com/chstudio/docker-images:php-ci.mysql_${PHP_VERSION}
fi
php-ci:7.0:
stage: build
variables:
PHP_ROOT_VERSION: "7.0"
PHP_IMAGE_TAG: "php:7.0-alpine"
services:
- docker:dind
only:
- master
<<: *php-ci-template
php-ci:7.1:
stage: build
variables:
PHP_ROOT_VERSION: "7.1"
PHP_IMAGE_TAG: "php:7.1-alpine"
services:
- docker:dind
only:
- master
<<: *php-ci-template
php-ci:7.2:
stage: build
variables:
PHP_ROOT_VERSION: "7.2"
PHP_IMAGE_TAG: "php:7.2-alpine"
services:
- docker:dind
only:
- master
<<: *php-ci-template
php-ci:latest:
stage: build
variables:
PHP_ROOT_VERSION: "latest"
PHP_IMAGE_TAG: "php:alpine"
PHP_XDEBUG_VERSION: "xdebug-2.7.0beta1"
services:
- docker:dind
only:
- master
<<: *php-ci-template