summaryrefslogtreecommitdiff
path: root/docker-entrypoint.sh
blob: b4bade67ab7f41e0db5b8845326474ab8287f96c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/sh
set -e

if [ ! -z "$HOST" ]; then
  ESCAPED_HOST=$(echo "$HOST" | sed 's/[\/&]/\\&/g')

  find /usr/share/nginx/html -name "*.css" -type f -exec sed -i "s|/static/|${ESCAPED_HOST}/|g" {} \;
  find /usr/share/nginx/html -name "*.js" -type f -exec sed -i "s|/static/|${ESCAPED_HOST}/|g" {} \;
  find /usr/share/nginx/html -name "*.html" -type f -exec sed -i "s|/static/|${ESCAPED_HOST}/|g" {} \;

  echo "Updated static URLs to use HOST: $HOST"
else
  echo "Serving static assets from root"
fi

exec nginx -g "daemon off;"