forked from docker-library/php
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·54 lines (46 loc) · 1.08 KB
/
build.sh
File metadata and controls
executable file
·54 lines (46 loc) · 1.08 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
#!/bin/bash
set -e
cd "$(dirname "$(readlink -f "$BASH_SOURCE")")"
source ./update.sh
versions=( "$@" )
if [ ${#versions[@]} -eq 0 ]; then
versions=( */ )
# exclude vendor directory
tmp=()
for value in "${versions[@]}"; do
if [ "$value" != "vendor/" ]; then
tmp+=($value)
fi
done
versions=("${tmp[@]}")
unset tmp
fi
versions=( "${versions[@]%/}" )
# Parameters: version, variant
function build () {
workdir="$PWD"
dockertag="$1"
dockerdir="$1"
if [ -n "$2" ]; then dockertag="$dockertag-$(echo $2 | tr '/' '-')"; dockerdir="$dockerdir/$2"; fi
echo "Building $dockertag"
cd "$dockerdir"
echo $(date --utc --iso-8601=seconds) > build.log
time docker build --rm --tag greencape/php:$dockertag . >> build.log
echo $(date --utc --iso-8601=seconds) >> build.log
cd "$workdir"
}
time for version in "${versions[@]}"; do
rcVersion="${version%-rc}"
build "$version"
if [ -d "$version/alpine" ]; then
build "$version" "alpine"
fi
for target in \
apache \
fpm fpm/alpine \
zts zts/alpine \
; do
[ -d "$version/$target" ] || continue
build "$version" "$target"
done
done