diff --git a/docker/dockerfiles/frontend.Dockerfile b/docker/dockerfiles/frontend.Dockerfile index 33468d89..6a5c8d5b 100644 --- a/docker/dockerfiles/frontend.Dockerfile +++ b/docker/dockerfiles/frontend.Dockerfile @@ -34,6 +34,15 @@ COPY --from=builder /app/build /usr/share/nginx/html # Copy custom NGINX configuration COPY --from=builder /app/nginx.conf /etc/nginx/nginx.conf +# Create config directory and set permissions +RUN mkdir -p /usr/share/nginx/html/config && \ + chown nginx:nginx /usr/share/nginx/html/config && \ + chmod 755 /usr/share/nginx/html/config + +# Copy the environment script +COPY ../frontend/generate-runtime-config.sh /docker-entrypoint.d/40-env.sh +RUN chmod +x /docker-entrypoint.d/40-env.sh + EXPOSE 80 USER nginx diff --git a/frontend/generate-runtime-config.sh b/frontend/generate-runtime-config.sh index b004dbc5..38f1ffbb 100755 --- a/frontend/generate-runtime-config.sh +++ b/frontend/generate-runtime-config.sh @@ -3,9 +3,6 @@ # This script generates a runtime config file with environment variables # It will be executed when the container starts -# Create config directory if it doesn't exist -mkdir -p /usr/share/nginx/html/config - # Generate the runtime-config.js file with the current environment variables cat > /usr/share/nginx/html/config/runtime-config.js << EOF // This file is auto-generated at runtime. Do not modify manually. diff --git a/frontend/public/index.html b/frontend/public/index.html index 881bd730..5102fc58 100644 --- a/frontend/public/index.html +++ b/frontend/public/index.html @@ -13,23 +13,5 @@
- diff --git a/frontend/src/index.js b/frontend/src/index.js index 0d0585f7..86b0876d 100644 --- a/frontend/src/index.js +++ b/frontend/src/index.js @@ -7,6 +7,7 @@ import { GenericLoader } from "./components/generic-loader/GenericLoader"; import { LazyLoader } from "./components/widgets/lazy-loader/LazyLoader.jsx"; import { SocketProvider } from "./helpers/SocketContext.js"; import "./index.css"; +import config from "./config.js"; const enablePosthog = process.env.REACT_APP_ENABLE_POSTHOG; if (enablePosthog !== "false") { @@ -22,6 +23,20 @@ if (enablePosthog !== "false") { }); } +// Utility to set favicon +function setFavicon(url) { + let link = document.querySelector("link[rel~='icon']"); + if (!link) { + link = document.createElement("link"); + link.rel = "icon"; + document.head.appendChild(link); + } + link.href = url; +} + +// Call this after config is loaded +setFavicon(config.favicon); + const root = ReactDOM.createRoot(document.getElementById("root")); root.render(