Skip to content

Commit 4bc72c3

Browse files
committed
made docker build images in parallel
1 parent f5e25ed commit 4bc72c3

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

run_docker_tests.sh

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,26 @@ fi
1111
docker compose down --remove-orphans || true
1212

1313
PHP_VERSIONS=("7.2" "7.4" "8.0" "8.2" "8.3" "8.4" "8.5")
14+
PHP_SERVICES=()
15+
for v in "${PHP_VERSIONS[@]}"; do
16+
PHP_SERVICES+=("phpunit-${v}")
17+
done
18+
19+
# Build all images in parallel first
20+
printf "Building images in parallel: %s\n" "${PHP_SERVICES[*]}"
21+
if ! docker compose build --parallel "${PHP_SERVICES[@]}"; then
22+
printf "\e[31mOne or more builds failed.\e[0m\n"
23+
exit 1
24+
fi
25+
1426
TESTS_PASSED=true
1527
EXIT_CODE=0
1628

1729
run_phpunit_tests() {
1830
local php_version="$1"
1931
printf "\n================[ Testing PHP ${php_version}: ]=============================================\n\n"
2032

21-
# Build the image
22-
if ! docker compose build "phpunit-${php_version}"; then
23-
printf "\e[31mBuild failed for PHP ${php_version}.\e[0m\n"
24-
return 1
25-
fi
26-
27-
# Use --rm to remove the ephemeral container after run
33+
# Run the test container (image already built above)
2834
if ! docker compose run --rm "phpunit-${php_version}"; then
2935
printf "\e[31mRun failed for PHP ${php_version}.\e[0m\n"
3036
return 1

0 commit comments

Comments
 (0)