Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docker/dockerfiles/frontend.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ RUN sed -i 's|</head>| <script src="/config/runtime-config.js"></script>\n <
COPY frontend/generate-runtime-config.sh /docker-entrypoint.d/40-env.sh
RUN chmod +x /docker-entrypoint.d/40-env.sh

# Capture build version at the very end so it doesn't affect layer caching.
# Empty default: the UI hides the version field when none was provided.
ARG VERSION=""
ENV UNSTRACT_APPS_VERSION=${VERSION}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@athul-rs does this get set during cloud builds as well?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes — cloud frontend builds go through docker bake with *.args.VERSION=${{ inputs.tag }} (cloud-frontend-docker-build-push.yaml), same as OSS production-build.yaml, so cloud images get the rc tag baked in automatically. On-prem frontend builds use the same workflow pattern.


EXPOSE 80

USER nginx
Expand Down
11 changes: 10 additions & 1 deletion frontend/generate-runtime-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,20 @@

# Generate the runtime-config.js file with the current environment variables
# Note: Using VITE_ prefix for Vite compatibility, fallback to REACT_APP_ for backward compatibility

# Escape backslashes and double quotes so values stay valid inside JS strings
js_escape() {
printf '%s' "$1" | sed -e 's/\\/\\\\/g' -e 's/"/\\"/g'
}

APP_VERSION=$(js_escape "${UNSTRACT_APPS_VERSION:-}")

cat > /usr/share/nginx/html/config/runtime-config.js << EOF
// This file is auto-generated at runtime. Do not modify manually.
window.RUNTIME_CONFIG = {
faviconPath: "${VITE_FAVICON_PATH:-${REACT_APP_FAVICON_PATH}}",
logoUrl: "${VITE_CUSTOM_LOGO_URL:-${REACT_APP_CUSTOM_LOGO_URL}}"
logoUrl: "${VITE_CUSTOM_LOGO_URL:-${REACT_APP_CUSTOM_LOGO_URL}}",
version: "${APP_VERSION}"
};
EOF

Expand Down
13 changes: 13 additions & 0 deletions frontend/src/components/profile/Profile.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { useNavigate } from "react-router-dom";
import "./Profile.css";

import { OrganizationIcon } from "../../assets";
import config from "../../config";
import { useAxiosPrivate } from "../../hooks/useAxiosPrivate";
import { useAlertStore } from "../../store/alert-store.js";
import { useSessionStore } from "../../store/session-store.js";
Expand Down Expand Up @@ -234,6 +235,18 @@ function Profile() {
</Typography.Text>
</div>
)}
{config.version && (
<div className="field-group">
<Typography.Text type="secondary" className="field-label">
Platform Version
</Typography.Text>
<div className="field-box">
<Typography.Text className="field-value">
{config.version}
</Typography.Text>
</div>
</div>
)}
</Space>
</Card>
</Col>
Expand Down
1 change: 1 addition & 0 deletions frontend/src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const config = {
import.meta.env.VITE_FAVICON_PATH ||
"/favicon.ico",
logoUrl: runtimeConfig.logoUrl || import.meta.env.VITE_CUSTOM_LOGO_URL,
version: runtimeConfig.version || import.meta.env.VITE_VERSION,
// Add more values as OR case, if needed for fallback.
};

Expand Down