1
1
#! /bin/bash
2
2
3
- # Exit if Docker credentials are not set
4
- if [ -z " $DOCKER_USER " ] || [ -z " $DOCKER_PASSWORD " ]; then
5
- echo " Docker username or password not set."
6
- exit 1
7
- fi
8
-
9
3
# Login to Docker registry
10
4
docker login -u " $DOCKER_USER " -p " $DOCKER_PASSWORD "
11
5
@@ -15,26 +9,26 @@ versions=(8.0.30 8.1.29 8.2.20 8.3.8)
15
9
# Iterate through each version
16
10
for version in " ${versions[@]} " ; do
17
11
# Extract major and minor version for image tag
18
- major_minor=$( echo $version | cut -d ' .' -f1,2 | tr -d ' .' )
12
+ major_minor=$( echo " $version " | cut -d ' .' -f1,2 | tr -d ' .' )
19
13
20
14
# Define repository name
21
15
REPOSITORY=" ${REPO} :php$major_minor "
22
16
23
17
# Build and push image without xdebug
24
18
docker build . --file php.Dockerfile \
25
- --build-arg PHP_VERSION=$version \
19
+ --build-arg PHP_VERSION=" $version " \
26
20
--build-arg NODE_VERSION=20 \
27
21
--build-arg WITH_XDEBUG=false \
28
22
--no-cache \
29
- --tag $REPOSITORY
30
- docker push $REPOSITORY
23
+ --tag " $REPOSITORY " \
24
+ --push
31
25
32
26
# Build and push image with xdebug
33
27
docker build . --file php.Dockerfile \
34
- --build-arg PHP_VERSION=$version \
28
+ --build-arg PHP_VERSION=" $version " \
35
29
--build-arg NODE_VERSION=20 \
36
30
--build-arg WITH_XDEBUG=true \
37
31
--no-cache \
38
- --tag $REPOSITORY -xdebug
39
- docker push $REPOSITORY -xdebug
32
+ --tag " $REPOSITORY " -xdebug \
33
+ --push
40
34
done
0 commit comments