Big Refactor

This commit is contained in:
John
2025-04-27 12:34:26 +12:00
parent d5c7dc7de6
commit 8614d29b06
20 changed files with 64 additions and 101 deletions

View File

@ -6,18 +6,23 @@
# It is called with the path to the server specific env file as an argument.
source "$(dirname "$0")/_common.sh"
load_env "$1" || die "Failed to load environment variables"
# Required environment variables
check_required_env_vars "CONTAINER_NAME" "IMAGE_REGISTRY" "IMAGE_REPO" "IMAGE_TAG" "LOCAL_DATA_FOLDER"
# Create local data folder if it doesn't exist
if [ -d "${LOCAL_DATA_FOLDER}" ]; then
echo "Local data folder ${LOCAL_DATA_FOLDER} exists, using existing data."
else
echo "Local data folder ${LOCAL_DATA_FOLDER} does not exist, creating..."
mkdir -p "${LOCAL_DATA_FOLDER}"
cat <<EOF > "${LOCAL_DATA_FOLDER}/index.html"
<html>
<body>
<h1>Hello, World!</h1>
</body>
</html>
EOF
fi
# Test Docker
@ -33,3 +38,4 @@ _remove_container $CONTAINER_NAME || die "Failed to remove container ${CONTAINER
bash ./start.sh $1 || die "Failed to start container ${CONTAINER_NAME}"
echo "Installation of ${CONTAINER_NAME} complete"
echo "You can access the service at http://${SERVER}:{HOST_PORT}"