-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
59 lines (53 loc) · 1.94 KB
/
Makefile
File metadata and controls
59 lines (53 loc) · 1.94 KB
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
SHELL=/bin/bash
SUDO=sudo
IMG_DH=wolnosciowiec/dokuwiki
IMG_QUAY=quay.io/riotkit/dokuwiki
PUSH=true
help:
@grep -E '^[a-zA-Z\-\_0-9\.@]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
all: ## Build all versions
set -xe; \
for version in $$(find ./versions -type f -name '*.json'); do \
make build VERSION=$$(basename -s .json $$version); \
make clean; \
done
build: ## Build a specifc version (VERSION parameter required. Possible values: old-stable, snapshot, stable. See "versions" directory)
set -xe; \
./notify.sh "$SLACK_URL" "Building dokuwiki version: ${VERSION}"; \
\
url=$$(jq -r '.URL' versions/${VERSION}.json); \
from=$$(jq -r '.FROM_IMAGE' versions/${VERSION}.json); \
\
wget $$url -O ./application.tar.gz; \
\
real_version=$$(tar --list --no-recursion --file=./application.tar.gz --exclude="*/*");\
real_version=$${real_version/splitbrain-dokuwiki-/}; \
real_version=$${real_version/dokuwiki-/}; \
real_version=$${real_version/\//}; \
tag=${VERSION}-$${real_version}; \
\
${SUDO} docker build . -f ./Dockerfile --build-arg VERSION=$$tag --build-arg FROM_IMAGE=$$from -t ${IMG_DH}:$${tag}; \
${SUDO} docker tag ${IMG_DH}:$${tag} ${IMG_QUAY}:$${tag}; \
\
${SUDO} docker tag ${IMG_DH}:$${tag} ${IMG_DH}:${VERSION}; \
${SUDO} docker tag ${IMG_DH}:$${tag} ${IMG_QUAY}:${VERSION}; \
\
${SUDO} docker tag ${IMG_DH}:$${tag} ${IMG_DH}:latest; \
${SUDO} docker tag ${IMG_DH}:$${tag} ${IMG_QUAY}:latest; \
\
\
\
if [[ "${PUSH}" == "true" ]]; then \
${SUDO} docker push ${IMG_DH}:$${tag}; \
${SUDO} docker push ${IMG_QUAY}:$${tag}; \
\
${SUDO} docker push ${IMG_DH}:${VERSION}; \
${SUDO} docker push ${IMG_QUAY}:${VERSION}; \
\
${SUDO} docker push ${IMG_DH}:latest; \
${SUDO} docker push ${IMG_QUAY}:latest; \
fi; \
\
./notify.sh "${SLACK_URL}" "[OK] built dokuwiki version: $${tag}"
clean: ## Clean up build files
rm -f ./Dockerfile application.tar.gz