mirror of
https://github.com/imputnet/cobalt.git
synced 2025-06-28 01:18:27 +00:00

Build and run image with ``` docker build -f web/Dockerfile -t cobalt-web . docker run -e WEB_DEFAULT_API="https://real.api.endpoint" -e WEB_HOST="http://abc" -e WEB_PLAUSIBLE_HOST="def" -p 800:80 cobalt-web ``` Currently, vite build still uses process.env env-vars at build time, so the docker container is not using those defined via placeholders in `runtime-config.js`
12 lines
401 B
Bash
12 lines
401 B
Bash
#!/bin/sh
|
|
set -e
|
|
|
|
# Replace config placeholders with runtime values
|
|
if [ -f "/usr/share/nginx/html/runtime-config.js" ]; then
|
|
envsubst '${WEB_HOST} ${WEB_PLAUSIBLE_HOST} ${WEB_DEFAULT_API}' \
|
|
< /usr/share/nginx/html/runtime-config.js \
|
|
> /usr/share/nginx/html/runtime-config.tmp.js && \
|
|
mv /usr/share/nginx/html/runtime-config.tmp.js /usr/share/nginx/html/runtime-config.js
|
|
fi
|
|
|
|
exec "$@" |