added dist to docker
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
#!/bin/sh
|
||||
|
||||
load_env_file() {
|
||||
file="$1"
|
||||
[ -f "$file" ] || return 0
|
||||
while IFS= read -r line || [ -n "$line" ]; do
|
||||
case "$line" in
|
||||
''|\#*) continue ;;
|
||||
esac
|
||||
key="${line%%=*}"
|
||||
val="${line#*=}"
|
||||
eval "current=\${$key-}"
|
||||
if [ -z "$current" ]; then
|
||||
export "$key=$val"
|
||||
fi
|
||||
done < "$file"
|
||||
}
|
||||
|
||||
load_env_file /app/.env.production
|
||||
load_env_file /app/.env
|
||||
|
||||
escape_sed() {
|
||||
printf '%s\n' "$1" | sed -e 's/[\/&]/\\&/g' -e 's/\./\\\./g'
|
||||
}
|
||||
|
||||
ESCAPED_API_BASE_URL=$(escape_sed "$VITE_API_BASE_URL")
|
||||
|
||||
if [ -d /app/dist ]; then
|
||||
find /app/dist -type f \( -name "*.js" -o -name "*.html" \) -exec sed -i \
|
||||
-e "s/__VITE_API_BASE_URL__/${ESCAPED_API_BASE_URL}/g" \
|
||||
{} \;
|
||||
fi
|
||||
|
||||
exec "$@"
|
||||
Reference in New Issue
Block a user