This repository has been archived by the owner on Sep 23, 2023. It is now read-only.
forked from serversideup/docker-php
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·58 lines (43 loc) · 1.62 KB
/
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash
# exit when any command fails
set -e
###########################################################################################
# PHP VERSIONS: Set these to match what's available in `/variables.yaml`
###########################################################################################
# Set versions
phpVersions=(
7.4
8.0
8.1
8.2
)
###########################################################################################
# Build script: Don't change anything below this line, unless you know what you're doing
###########################################################################################
# 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 )"
TEMPLATE_DIR=templates
OUTPUT_DIR=generated-dockerfiles
# Grab each PHP version from above and go through these steps
for version in ${phpVersions[@]}; do
# Copy over template directory
rsync -a $TEMPLATE_DIR/ $SCRIPT_DIR/$OUTPUT_DIR/${version[$i]} --delete
# Apply Jinja2 templates using "Yasha"
find $SCRIPT_DIR/$OUTPUT_DIR/${version[$i]} -name '*.j2' -exec yasha --php_version=$version --php_packages= -v $SCRIPT_DIR/variables.yaml {} \;
# Remove old applied template files
find $SCRIPT_DIR/$OUTPUT_DIR/${version[$i]} -name '*.j2' -exec rm {} \;
ui_set_green && echo "✅ Template build has completed for PHP ${version[$i]}" && ui_reset_colors
done