diff options
| author | Elizabeth Hunt <me@liz.coffee> | 2025-12-13 00:50:07 -0800 |
|---|---|---|
| committer | Elizabeth Hunt <me@liz.coffee> | 2025-12-13 00:50:07 -0800 |
| commit | 666df5fc3b64c6cc9f6fc03fed46a441d7fcd315 (patch) | |
| tree | 19d2b927e8fd358f63b340f2edbd1f5341e51642 /docker-entrypoint.sh | |
| parent | 4cb732c77da7c350a656f1d12504b499fb2d80c5 (diff) | |
| download | adelie-666df5fc3b64c6cc9f6fc03fed46a441d7fcd315.tar.gz adelie-666df5fc3b64c6cc9f6fc03fed46a441d7fcd315.zip | |
Add entrypoint which replaces static with prod url
Diffstat (limited to 'docker-entrypoint.sh')
| -rw-r--r-- | docker-entrypoint.sh | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh new file mode 100644 index 0000000..55e2b6c --- /dev/null +++ b/docker-entrypoint.sh @@ -0,0 +1,21 @@ +#!/bin/sh +set -e + +# If HOST is set, replace /static/ URLs in CSS and JS files +if [ ! -z "$HOST" ]; then + # Escape special characters for sed + ESCAPED_HOST=$(echo "$HOST" | sed 's/[\/&]/\\&/g') + + # Replace /static/ paths in all CSS files + find /usr/share/nginx/html -name "*.css" -type f -exec sed -i "s|/static/|${ESCAPED_HOST}/static/|g" {} \; + + # Replace /static/ paths in all JS files + find /usr/share/nginx/html -name "*.js" -type f -exec sed -i "s|/static/|${ESCAPED_HOST}/static/|g" {} \; + + echo "✓ Updated static URLs to use HOST: $HOST" +else + echo "✓ Serving static assets from /static/ (local, no HOST set)" +fi + +# Start nginx in foreground +exec nginx -g "daemon off;" |
