Split builds into versions.

Allow more builds to run in parallel.
This commit is contained in:
Paolo Cuffiani
2015-11-13 19:19:22 +01:00
parent 97a29e2058
commit 279a72c7cb
3 changed files with 52 additions and 54 deletions
+20 -23
View File
@@ -1,20 +1,19 @@
SHELL := /bin/bash
.PHONY: pull build-nopull build test
PARENT_IMAGE = chialab/php
IMAGE = chialab/php-dev
TAGS = \
latest \
5.4 \
5.4-apache \
5.4-fpm \
5.5 \
5.5-apache \
5.5-fpm \
5.6 \
5.6-apache \
5.6-fpm
EXTENSIONS = \
PARENT_IMAGE := chialab/php
IMAGE := chialab/php-dev
VERSION ?= latest
# Tags.
TAGS := $(VERSION)
ifneq ($(VERSION),latest)
# Add `-apache` and `-fpm` suffix.
TAGS += $(VERSION)-apache $(VERSION)-fpm
endif
# Extensions.
EXTENSIONS := \
bz2 \
calendar \
iconv \
@@ -22,29 +21,27 @@ EXTENSIONS = \
gd \
mbstring \
mcrypt \
memcached \
mysql \
mysqli \
pdo_mysql \
pdo_pgsql \
pgsql \
redis \
Xdebug \
zip
NO_PHP_7 = memcached mysql redis
ifneq ($(VERSION),7.0)
# Add more extensions to 5.x series images.
EXTENSIONS += memcached mysql redis
endif
pull:
@for tag in $(TAGS); do \
docker pull $(PARENT_IMAGE):$${tag}; \
done
$(foreach tag,$(TAGS),docker pull $(PARENT_IMAGE):${tag};)
build-nopull:
@for tag in $(TAGS); do \
echo " =====> Building $(IMAGE):$${tag}..."; \
dir="$${tag/-//}"; \
if [[ "$${tag}" == 'latest' ]]; then \
dir='.'; \
fi; \
echo " =====> Building $(IMAGE):$${tag}..."; \
docker build --quiet -t $(IMAGE):$${tag} $${dir}; \
done
@@ -60,7 +57,7 @@ test:
fi; \
modules=`docker run --rm $(IMAGE):$${tag} php -m`; \
for ext in $(EXTENSIONS); do \
if ([[ "$${tag}" != '7'* ]] || [[ "$(NO_PHP_7)" != *"$${ext}"* ]]) && [[ "$${modules}" != *"$${ext}"* ]]; then \
if [[ "$${modules}" != *"$${ext}"* ]]; then \
echo "FAIL [$${ext}]"; \
exit 1; \
fi \