forked from MilesChou/php-tools-action
-
Notifications
You must be signed in to change notification settings - Fork 0
/
update.sh
executable file
·61 lines (47 loc) · 1.35 KB
/
update.sh
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
60
61
#!/usr/bin/env bash
generated_warning() {
cat <<-EOH
#
# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh"
#
# PLEASE DO NOT EDIT IT DIRECTLY.
#
EOH
}
build_dockerfile() {
echo "Build ./${1}/Dockerfile ..."
generated_warning > ./${1}/Dockerfile
for version in ${VERSIONS}; do
echo "Build ./${version}/${1}/Dockerfile ..."
mkdir -p ${version}/${1}
generated_warning > ./${version}/${1}/Dockerfile
cat ./${1}/Dockerfile.template | sed -e 's!%%PHP_VERSION%%!'"${version}-alpine"'!' >> ./${version}/${1}/Dockerfile
cp ./${1}/entrypoint.sh ${version}/${1}/entrypoint.sh
cp ./${1}/docker-install-${1} ${version}/${1}/docker-install-${1}
LATEST_VERSION=${version}
done
echo "Build ./${1}/Dockerfile using latest version (${LATEST_VERSION})..."
rm -f ./${1}/Dockerfile
generated_warning > ./${LATEST_VERSION}/${1}/Dockerfile
cat ./${1}/Dockerfile.template | sed -e 's!%%PHP_VERSION%%!'"${LATEST_VERSION}-alpine"'!' >> ./${1}/Dockerfile
}
VERSIONS="
5.5
5.6
7.0
7.1
7.2
7.3
7.4
8.0
8.1
8.2
"
echo "Build Dockerfile for PHP CodeSniffer ..."
build_dockerfile phpcs
echo "Build Dockerfile for PHP Mess Detector ..."
build_dockerfile phpmd
echo "Build Dockerfile for PhpMetrics ..."
build_dockerfile phpmetrics
echo "Build Dockerfile for PHPUnit ..."
build_dockerfile phpunit