Skip to content

Commit

Permalink
Add support for building multiple PHP versions on docker
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiasmullie committed Dec 6, 2017
1 parent d39132a commit abc21b3
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 5 deletions.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM php:cli
ARG version=cli
FROM php:$version

COPY . /var/www
WORKDIR /var/www
Expand Down
22 changes: 21 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '3'
version: '2.1'
services:
php:
build:
Expand All @@ -9,3 +9,23 @@ services:
- ./data:/var/www/data
- ./tests:/var/www/tests
- ./phpunit.xml.dist:/var/www/phpunit.xml.dist
'7.2':
extends: php
build:
args:
version: 7.2-cli
'7.1':
extends: php
build:
args:
version: 7.1-cli
'7.0':
extends: php
build:
args:
version: 7.0-cli
'5.6':
extends: php
build:
args:
version: 5.6-cli
8 changes: 5 additions & 3 deletions makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
PHP ?= '7.2'

docs:
wget http://apigen.org/apigen.phar
chmod +x apigen.phar
Expand All @@ -8,12 +10,12 @@ image:
docker build -t matthiasmullie/minify .

up:
docker-compose up -d php
docker-compose up -d $(PHP)

down:
docker-compose stop -t0 php
docker-compose stop -t0 $(PHP)

test:
[ $(UP) -eq 1 ] && make up || true
$(eval cmd='docker-compose run php vendor/bin/phpunit')
$(eval cmd='docker-compose run $(PHP) vendor/bin/phpunit')
eval $(cmd); status=$$?; [ $(DOWN) -eq 1 ] && make down; exit $$status

0 comments on commit abc21b3

Please sign in to comment.