-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpublish.sh
More file actions
executable file
·67 lines (57 loc) · 2.48 KB
/
Copy pathpublish.sh
File metadata and controls
executable file
·67 lines (57 loc) · 2.48 KB
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
62
63
64
65
66
67
#!/bin/bash
# Configuration: map of Magento versions to their required PHP version
declare -A MAGENTO_VERSIONS=(
["2.4.9"]="8.4"
["2.4.8-p5"]="8.3"
["2.4.7-p10"]="8.3"
)
# Configuration: list of PHP versions to build
PHP_VERSIONS=("8.3" "8.4")
if [ -z "$MAGENTO_COMPOSER_AUTH" ]; then
echo "No \$MAGENTO_COMPOSER_AUTH value set, exiting!"
exit 1
fi;
if [ ! -z "$DOCKER_PASS" ]; then
echo "$DOCKER_PASS" | docker login -u "$DOCKER_USER" --password-stdin
fi
build_php() {
local php_ver=$1
echo "Building image outeredge/edge-docker-php-dev:${php_ver}-frankenphp with Dockerfile.php${php_ver//./}-frankenphp"
DOCKER_BUILDKIT=1 docker build --pull . -t outeredge/edge-docker-php-dev:${php_ver}-frankenphp -f Dockerfile.php${php_ver//./}-frankenphp && \
docker push outeredge/edge-docker-php-dev:${php_ver}-frankenphp
}
build_magento() {
local magento_ver=$1
local php_ver=${MAGENTO_VERSIONS[$magento_ver]}
echo "Building image outeredge/edge-docker-php-dev:magento-${magento_ver} with Dockerfile.magento-frankenphp (PHP ${php_ver})"
DOCKER_BUILDKIT=1 docker build . -t outeredge/edge-docker-php-dev:magento-${magento_ver} \
-f Dockerfile.magento-frankenphp \
--build-arg PHP_VERSION=${php_ver} \
--build-arg COMPOSER_AUTH=${MAGENTO_COMPOSER_AUTH} \
--build-arg MAGENTO_VERSION=${magento_ver} && \
docker push outeredge/edge-docker-php-dev:magento-${magento_ver}
}
if [ -z "$1" ]; then
echo "No version specified, building all from configuration..."
for php_ver in "${PHP_VERSIONS[@]}"; do
build_php "$php_ver" || { echo "Build failed for PHP $php_ver"; exit 1; }
done
for magento_ver in "${!MAGENTO_VERSIONS[@]}"; do
build_magento "$magento_ver" || { echo "Build failed for Magento $magento_ver"; exit 1; }
done
else
# Check if the argument is a known Magento version
if [ ! -z "${MAGENTO_VERSIONS[$1]}" ]; then
build_magento "$1" || { echo "Build failed for Magento $1"; exit 1; }
else
# If a specific PHP version is provided, build that and its dependent Magento versions
php_ver=$1
build_php "$php_ver" || { echo "Build failed for PHP $php_ver"; exit 1; }
for magento_ver in "${!MAGENTO_VERSIONS[@]}"; do
if [ "${MAGENTO_VERSIONS[$magento_ver]}" == "$php_ver" ]; then
build_magento "$magento_ver" || { echo "Build failed for Magento $magento_ver"; exit 1; }
fi
done
fi
fi
echo "Complete!"