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
1 change: 0 additions & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ on:
- sandbox-ui
- microplan-ui
- console
- dashboard-ui
- payments-ui
- storybook-svg
- storybook
Expand Down
5 changes: 0 additions & 5 deletions build/build-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,6 @@ config:
dockerfile: health/micro-ui/web/core/Dockerfile
image-name: core-ui

- name: builds/Digit-Frontend/health/dashboard-ui
build:
- work-dir: health/micro-ui/
dockerfile: health/micro-ui/web/health-dss/Dockerfile
image-name: dashboard-ui

# Others
- name: builds/Digit-Frontend/storybook-svg
Expand Down
4 changes: 2 additions & 2 deletions health/micro-ui/web/health-dss/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ RUN yarn build:webpack

FROM nginx:mainline-alpine
#FROM ghcr.io/egovernments/nginx:mainline-alpine
ENV WORK_DIR=/var/web/dashboard-ui
ENV WORK_DIR=/var/web/microplan-ui

RUN mkdir -p ${WORK_DIR}

COPY --from=build /app/web/build ${WORK_DIR}/
COPY --from=build /app/web/health-dss/nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=build /app/web/health-dss/nginx.conf /etc/nginx/conf.d/default.conf
Comment on lines +40 to +45
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

WORK_DIR aligns; harden runtime image (non-root + healthcheck)

The new WORK_DIR (/var/web/microplan-ui) matches nginx root mapping. Strengthen security and operability by running as non-root and adding a basic healthcheck.

Apply:

 ENV WORK_DIR=/var/web/microplan-ui
 
 RUN mkdir -p ${WORK_DIR}
 
 COPY --from=build /app/web/build ${WORK_DIR}/
 COPY --from=build /app/web/health-dss/nginx.conf /etc/nginx/conf.d/default.conf
+RUN chown -R nginx:nginx ${WORK_DIR} /var/cache/nginx /var/run
+USER nginx
+HEALTHCHECK --interval=30s --timeout=3s --retries=3 CMD wget -q --spider http://127.0.0.1:80/microplan-ui/ || exit 1

Additional note (outside this range): consider upgrading the build stage to an LTS base (Node 18/20) to avoid EOL risks:
Dockerfile

FROM node:18-alpine AS build

Confirm alignment across files:


🏁 Script executed:

#!/bin/bash
set -euo pipefail
echo "Dockerfile WORK_DIR:"; rg -nP '^ENV\s+WORK_DIR=.*microplan-ui' health/micro-ui/web/health-dss/Dockerfile
echo "nginx location/root:"; rg -nP 'location\s+/microplan-ui|^\s*root\s+/var/web\b' health/micro-ui/web/health-dss/nginx.conf -n
echo "webpack publicPath:"; rg -nP 'publicPath\s*:\s*["\']/microplan-ui/' health/micro-ui/web/health-dss/webpack.config.js -n

Length of output: 511


🏁 Script executed:

#!/bin/bash
set -euo pipefail
echo "webpack publicPath:" 
rg -nP "publicPath\s*:\s*[\"']/microplan-ui/" health/micro-ui/web/health-dss/webpack.config.js -n

Length of output: 207


Harden runtime image: run as non-root & add basic healthcheck

Alignment across Dockerfile, nginx.conf and webpack.config.js confirmed. To strengthen security and observability, consider this optional refactor in your final stage:

 ENV WORK_DIR=/var/web/microplan-ui

 RUN mkdir -p ${WORK_DIR}

 COPY --from=build /app/web/build ${WORK_DIR}/
 COPY --from=build /app/web/health-dss/nginx.conf /etc/nginx/conf.d/default.conf
+RUN chown -R nginx:nginx ${WORK_DIR} /var/cache/nginx /var/run
+USER nginx
+HEALTHCHECK --interval=30s --timeout=3s --retries=3 \
+  CMD wget -q --spider http://127.0.0.1:80/microplan-ui/ || exit 1

Optional upgrade for build stage to avoid EOL risk:

FROM node:18-alpine AS build
🧰 Tools
🪛 Checkov (3.2.334)

[LOW] 1-45: Ensure that HEALTHCHECK instructions have been added to container images

(CKV_DOCKER_2)


[LOW] 1-45: Ensure that a user for the container has been created

(CKV_DOCKER_3)

🤖 Prompt for AI Agents
In health/micro-ui/web/health-dss/Dockerfile around lines 40 to 45, the runtime
stage currently runs as root and lacks a container healthcheck; update the final
stage to create a non-root user, chown the WORK_DIR and served files to that
user, switch to that user with USER before CMD, and add a basic HEALTHCHECK that
probes nginx (e.g., curl to localhost:80 or use wget) with sensible retries and
interval; optionally, also update the build stage base image to node:18-alpine
to avoid EOL risk if desired.

2 changes: 1 addition & 1 deletion health/micro-ui/web/health-dss/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ server
listen 80;
underscores_in_headers on;

location /dashboard-ui
location /microplan-ui
{
root /var/web;
index index.html index.htm;
Expand Down
2 changes: 1 addition & 1 deletion health/micro-ui/web/health-dss/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"micro-ui-internals/packages/modules/campaign-manager",
"micro-ui-internals/packages/modules/health-dss"
],
"homepage": "/dashboard-ui",
"homepage": "/microplan-ui",
"dependencies": {
"@egovernments/digit-ui-libraries": "1.8.17",
"@egovernments/digit-ui-module-core": "1.8.30",
Expand Down
2 changes: 1 addition & 1 deletion health/micro-ui/web/health-dss/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ module.exports = {
output: {
filename: "[name].bundle.js",
path: path.resolve(__dirname, "build"),
publicPath: "/dashboard-ui/",
publicPath: "/microplan-ui/",
},
Comment on lines +34 to 35
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Public path change looks good; verify router/base href alignment

Switching output.publicPath to "/microplan-ui/" aligns with nginx and Dockerfile. Ensure your SPA router basename (e.g., React Router) or the in public/index.html also reflects "/microplan-ui/" to avoid broken asset/routes.

Run to find lingering "/dashboard-ui" references and check base href:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Any legacy path refs in this app?
rg -nC2 -g 'health/micro-ui/web/health-dss/**' '/dashboard-ui\b' || echo "No legacy /dashboard-ui refs found under health-dss."

# Confirm webpack publicPath
rg -nP 'publicPath\s*:\s*["\']([^"\']+)["\']' health/micro-ui/web/health-dss/webpack.config.js

# Inspect base href in any index.html files
fd -a --strip-cwd-prefix index.html health/micro-ui/web/health-dss | xargs -r -I{} rg -nH -P '<base\s+href=["\']([^"\']+)["\']' "{}" || echo "No <base href> tags found."

Length of output: 527


Let’s re-run with simpler commands to confirm both the webpack publicPath and any <base href> tags:


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

# 1. Check webpack publicPath setting
grep -RIn "publicPath" health/micro-ui/web/health-dss/webpack.config.js || echo "publicPath not found in webpack.config.js"

# 2. Look for any <base href> in index.html files
grep -RIn "<base[^>]*href" health/micro-ui/web/health-dss || echo "No <base href> tags found"

Length of output: 249


Align nginx.conf and HTML base href with the new publicPath

We’ve confirmed that output.publicPath is correctly set to "/microplan-ui/", but there are two outstanding alignment issues that will break routing/assets if not addressed:

• health/micro-ui/web/health-dss/nginx.conf (line 10):

try_files $uri $uri/ /dashboard-ui/index.html;

Update to:

try_files $uri $uri/ /microplan-ui/index.html;

• No <base href> found in your HTML templates. In your main index.html (e.g., public/index.html), add inside <head>:

<base href="/microplan-ui/">

• Ensure your SPA router (e.g., React Router’s <BrowserRouter basename="…">) also uses /microplan-ui/ so client-side routes resolve correctly.

🤖 Prompt for AI Agents
In health/micro-ui/web/health-dss/webpack.config.js around lines 34-35 the
output.publicPath was changed to "/microplan-ui/", but you must also update
health/micro-ui/web/health-dss/nginx.conf (line 10) to point try_files to
/microplan-ui/index.html instead of /dashboard-ui/index.html, add a <base
href="/microplan-ui/"> element inside the <head> of your main HTML template
(e.g., public/index.html), and ensure the SPA router (e.g., React Router
<BrowserRouter basename="...">) is configured with basename="/microplan-ui/" so
assets and client-side routes resolve correctly.

optimization: {
splitChunks: {
Expand Down
3 changes: 2 additions & 1 deletion health/micro-ui/web/microplan/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
},
"workspaces": [
"micro-ui-internals/packages/modules/microplan",
"micro-ui-internals/packages/modules/campaign-manager"
"micro-ui-internals/packages/modules/campaign-manager",
"micro-ui-internals/packages/modules/health-dss"
],
"homepage": "/microplan-ui",
"dependencies": {
Expand Down
4 changes: 3 additions & 1 deletion health/micro-ui/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"workspaces": [
"micro-ui-internals/packages/modules/campaign-manager",
"micro-ui-internals/packages/modules/health-hrms",
"micro-ui-internals/packages/modules/pgr"
"micro-ui-internals/packages/modules/pgr",
"micro-ui-internals/packages/modules/health-dss"
],
"homepage": "/workbench-ui",
"dependencies": {
Expand All @@ -21,6 +22,7 @@
"@egovernments/digit-ui-module-hcmworkbench": "0.1.5",
"@egovernments/digit-ui-module-utilities": "1.0.12",
"@egovernments/digit-ui-module-campaign-manager": "0.4.0",
"@egovernments/digit-ui-module-health-dss": "0.0.1",
"@egovernments/digit-ui-module-health-pgr": "0.0.1",
"@egovernments/digit-ui-react-components": "1.8.24",
"@egovernments/digit-ui-svg-components": "1.0.21",
Expand Down
Loading