-
Notifications
You must be signed in to change notification settings - Fork 0
/
dev.sh
executable file
·69 lines (55 loc) · 1.38 KB
/
dev.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
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
68
69
#!/bin/bash
#exit on error
set -e
##########################
# UI Colors
function ui_set_yellow {
printf $'\033[0;33m'
}
function ui_set_green {
printf $'\033[0;32m'
}
function ui_set_red {
printf $'\033[0;31m'
}
function ui_reset_colors {
printf "\e[0m"
}
# Script Configurations
SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
##########################
# Set versions to build
if [ $# -eq 0 ]; then
# Set versions
phpVersions=(
7.4
8.0
8.1
8.2
)
else
phpVersions=$1
fi
##########################
# Functions
function build (){
label=$(echo $1 | tr '[:lower:]' '[:upper:]')
ui_set_yellow && echo "⚡️ Running build for $label ..." && ui_reset_colors
# Use "docker build"
docker buildx build \
--build-arg PHP_VERSION="${1}" \
--push \
--platform linux/amd64,linux/arm/v7,linux/arm64/v8 \
--tag "mpopowicz/php:${1}-apache" \
$SCRIPT_DIR/src/
ui_set_green && echo "✅ Build completed for $label - ${2} ..." && ui_reset_colors
}
function build_versions {
# Grab each PHP version defined in `build.sh` and deploy these images to our LOCAL registry
for version in ${phpVersions[@]}; do
build ${version[$i]}
done
}
##########################
# Main script starts here
build_versions