forked from piplos/php-alpine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
30 lines (26 loc) · 798 Bytes
/
Makefile
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
SHELL := /bin/bash
ALL: build
.PHONY: build test push
IMAGE := piplosmedia/php-fpm
VERSION ?= latest
PHP_VERSION = $(firstword $(subst -, ,$(VERSION)))
build:
@echo " =====> Building $(IMAGE):$(VERSION)..."
@dir="$(subst -,/,$(VERSION))"; \
if [[ "$(VERSION)" == 'latest' ]]; then \
dir='.'; \
fi; \
docker image build --quiet -t $(IMAGE):$(VERSION) $${dir}
test:
@echo -e "=====> Testing loaded extensions... \c"
@if [[ -z `docker image ls $(IMAGE) | grep "\s$(VERSION)\s"` ]]; then \
echo 'FAIL [Missing image!!!]'; \
exit 1; \
fi
@if [[ -z `docker container run --rm $(IMAGE):$(VERSION) composer --version 2> /dev/null | grep '^Composer version 2\.[0-9][0-9]*'` ]]; then \
echo 'FAIL [Composer 2]'; \
exit 1; \
fi
@echo 'OK'
push:
docker image push $(IMAGE):$(VERSION)