Merge pull request 'Update script to default to PHP 8.3 and have options' (#12) from add-php83 into trunk
All checks were successful
Cloud Apache Container / Build-and-Push (push) Successful in 32s

Reviewed-on: #12
This commit is contained in:
jknapp 2024-10-02 18:55:46 +00:00
commit 565482764d

View File

@ -5,18 +5,20 @@ https_port='443'
root_path="$(pwd)" root_path="$(pwd)"
verbose='false' verbose='false'
while getopts 'n:p:s:r:vh' flag; do while getopts 'n:p:s:r:a:vh' flag; do
case "${flag}" in case "${flag}" in
n) name="${OPTARG}" ;; n) name="${OPTARG}" ;;
p) http_port="${OPTARG}" ;; p) http_port="${OPTARG}" ;;
s) https_port="${OPTARG}" ;; s) https_port="${OPTARG}" ;;
r) root_path="${OPTARG}" ;; r) root_path="${OPTARG}" ;;
a) phpver="${OPTARG}" ;;
v) verbose='true' ;; v) verbose='true' ;;
h) echo "Variables" h) echo "Variables"
echo "-n = Name of Container, Required" echo "-n = Name of Container, Required"
echo "-p = Non-https Port Override, default 80" echo "-p = Non-https Port Override, default 80"
echo "-s = Https Port Override, default 443" echo "-s = Https Port Override, default 443"
echo "-r = Root Path for files and database, defaults to current working path" echo "-r = Root Path for files and database, defaults to current working path"
echo "-a = PHP App Version, Default to 8.3"
echo "-v = Enable Verbose Mode" echo "-v = Enable Verbose Mode"
exit 1 ;; exit 1 ;;
esac esac
@ -43,7 +45,7 @@ fi
if [ ! -d "$root_path/web" ]; then if [ ! -d "$root_path/web" ]; then
mkdir -p "$root_path/web"; mkdir -p "$root_path/web";
fi fi
$check_docker run -d -p "$http_port":80 -p "$https_port":443 -e PHPVER=82 -e environment=DEV --mount type=bind,source="$root_path"/web,target=/home/"$user"/public_html --mount type=bind,source="$root_path"/db,target=/var/lib/mysql -e uid="$uid" -e user="$user" -e domain="$name-local.dev" --name "$name" repo.anhonesthost.net/cloud-hosting-platform/cac:latest $check_docker run -d -p "$http_port":80 -p "$https_port":443 -e PHPVER="$phpver":83 -e environment=DEV --mount type=bind,source="$root_path"/web,target=/home/"$user"/public_html --mount type=bind,source="$root_path"/db,target=/var/lib/mysql -e uid="$uid" -e user="$user" -e domain="$name-local.dev" --name "$name" repo.anhonesthost.net/cloud-hosting-platform/cac:latest
echo "Creating management scripts in root directory..." echo "Creating management scripts in root directory..."
echo "#!/usr/bin/env bash" > "$root_path/instance_start" echo "#!/usr/bin/env bash" > "$root_path/instance_start"
echo "docker start $name" >> "$root_path/instance_start" echo "docker start $name" >> "$root_path/instance_start"