Update script to default to PHP 8.3 and have options

This commit is contained in:
Josh Knapp 2024-10-02 11:55:22 -07:00
parent 36757fac8f
commit 3d3e353c66

View File

@ -5,18 +5,20 @@ https_port='443'
root_path="$(pwd)"
verbose='false'
while getopts 'n:p:s:r:vh' flag; do
while getopts 'n:p:s:r:a:vh' flag; do
case "${flag}" in
n) name="${OPTARG}" ;;
p) http_port="${OPTARG}" ;;
s) https_port="${OPTARG}" ;;
r) root_path="${OPTARG}" ;;
a) phpver="${OPTARG}" ;;
v) verbose='true' ;;
h) echo "Variables"
echo "-n = Name of Container, Required"
echo "-p = Non-https Port Override, default 80"
echo "-s = Https Port Override, default 443"
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"
exit 1 ;;
esac
@ -43,7 +45,7 @@ fi
if [ ! -d "$root_path/web" ]; then
mkdir -p "$root_path/web";
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 "#!/usr/bin/env bash" > "$root_path/instance_start"
echo "docker start $name" >> "$root_path/instance_start"