Skip to content

Commit 084fa2d

Browse files
committed
Add a build script to create all the images in a local system
1 parent 7fc78d9 commit 084fa2d

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

build.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
3+
# List of PHP versions to build
4+
PHP_VERSIONS=("7.0" "7.1" "7.2" "7.4" "8.0" "8.1" "8.2" "8.3" "8.4")
5+
6+
# Base image name
7+
IMAGE_NAME="pattonwebz/local-wordpress-with-xdebug"
8+
9+
# Build for all versions
10+
for version in "${PHP_VERSIONS[@]}"; do
11+
echo "Building image for PHP $version..."
12+
docker build --build-arg PHP_VERSION="php${version}-apache" -t "${IMAGE_NAME}:php${version}-apache" .
13+
14+
# Tag latest for the newest stable version (currently 8.2)
15+
if [ "$version" = "8.2" ]; then
16+
docker tag $IMAGE_NAME:"php${version}-apache" $IMAGE_NAME:latest
17+
echo "Tagged PHP $version as latest"
18+
fi
19+
done
20+
21+
echo "All images built successfully"
22+
echo "Available images:"
23+
docker images | grep $IMAGE_NAME

0 commit comments

Comments
 (0)