-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
70 lines (62 loc) · 1.93 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
stages:
- build
variables:
IMAGE: "$CI_REGISTRY_IMAGE"
# see available releases at https://hub.docker.com/_/composer and https://github.com/composer/composer/releases
COMPOSER_VERSION: "2"
# latest version; for 7.x we set this per Job to "xdebug-2.9.8"; for php 8+ we get xdebug 3; see https://xdebug.org/docs/upgrade_guide
XDEBUG_VERSION: "xdebug"
# default branch template - build image tagged w/ minor php version
.build: &BUILD
stage: build
image: docker:stable
services:
- docker:dind
only:
- main
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
# Pull old image to use cache if possible
- docker pull "${IMAGE}:${VERSION}-dev" || echo "No preexisting image found"
- docker build --pull
--build-arg XDEBUG_VERSION=${XDEBUG_VERSION}
--build-arg COMPOSER_VERSION=${COMPOSER_VERSION}
--target base
-f "${DOCKERFILE}"
-t "${IMAGE}:${VERSION}-base" .
- docker build --pull --no-cache
--build-arg XDEBUG_VERSION=${XDEBUG_VERSION}
--build-arg COMPOSER_VERSION=${COMPOSER_VERSION}
--target dev
-f "${DOCKERFILE}"
-t "${IMAGE}:${VERSION}-dev" .
- docker run --rm -i "${IMAGE}:${VERSION}-dev" php-fpm -t
- docker push "${IMAGE}:${VERSION}-base"
- docker push "${IMAGE}:${VERSION}-dev"
# -------------------------------------------------------------------
# Stage: build
# -------------------------------------------------------------------
v8.1:
<<: *BUILD
variables:
VERSION: "8.1"
DOCKERFILE: php81/Dockerfile
XDEBUG_VERSION: "xdebug-3.1.3"
v8.0:
<<: *BUILD
variables:
VERSION: "8.0"
DOCKERFILE: php80/Dockerfile
XDEBUG_VERSION: "xdebug-3.1.3"
v7.4:
<<: *BUILD
variables:
VERSION: "7.4"
DOCKERFILE: php74/Dockerfile
XDEBUG_VERSION: "xdebug-2.9.8"
v7.3:
<<: *BUILD
variables:
VERSION: "7.3"
DOCKERFILE: php73/Dockerfile
XDEBUG_VERSION: "xdebug-2.9.8"