cobalt/web/docker-entrypoint.sh
Jonathan Chemla 782045dd82 Cobalt Web image Dockerfile
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`
2025-06-25 12:56:36 +02:00

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 "$@"