Add docker build file for UI and associated Actions workflow

This commit is contained in:
Nix
2025-05-04 14:13:02 -04:00
parent 9cbf26e29e
commit 8502630550
13 changed files with 159 additions and 3 deletions
+6
View File
@@ -0,0 +1,6 @@
http://* {
root * /app
encode
try_files {path} /index.html
file_server
}
+27
View File
@@ -0,0 +1,27 @@
#!/bin/sh
# Generate sed script file
sed_script="/tmp/sed_script.sed"
> "$sed_script"
# Ensure the sed script file is cleaned up on exit
trap 'rm -f "$sed_script"' EXIT
# Extract VITE_ environment variables and build the sed expression
env | grep '^VITE_' | while IFS='=' read -r key value; do
# Escape slashes and other special characters in key and value
escaped_key=$(printf '%s' "$key" | sed 's/[\/&]/\\&/g')
escaped_value=$(printf '%s' "$value" | sed 's/[\/&]/\\&/g')
# Append to sed script file
echo "s|${escaped_key}|${escaped_value}|g;" >> "$sed_script"
done
# Check if the sed script file was created and is not empty
if [ ! -s "$sed_script" ]; then
echo "No VITE_ environment variables found. Exiting with error."
exit 1
fi
# sed All files
find /app -type f -exec sed -i -f "$sed_script" '{}' +
caddy run --config /etc/caddy/Caddyfile --adapter caddyfile