-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
34 lines (28 loc) · 979 Bytes
/
build.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
#!/bin/bash
# Login to Docker registry
docker login -u "$DOCKER_USER" -p "$DOCKER_PASSWORD"
# Array of PHP versions
versions=(8.0.30 8.1.31 8.2.27 8.3.15, 8.4.2)
# Iterate through each version
for version in "${versions[@]}"; do
# Extract major and minor version for image tag
major_minor=$(echo "$version" | cut -d '.' -f1,2 | tr -d '.')
# Define repository name
REPOSITORY="${REPO}:php$major_minor"
# Build and push image without xdebug
docker build . --file php.Dockerfile \
--build-arg PHP_VERSION="$version" \
--build-arg NODE_VERSION=20 \
--build-arg WITH_XDEBUG=false \
--no-cache \
--tag "$REPOSITORY" \
--push
# Build and push image with xdebug
docker build . --file php.Dockerfile \
--build-arg PHP_VERSION="$version" \
--build-arg NODE_VERSION=20 \
--build-arg WITH_XDEBUG=true \
--no-cache \
--tag "$REPOSITORY"-xdebug \
--push
done