Skip to content

Narratives services image - #444

Open
ddebasmita-lab wants to merge 2 commits into
datacommonsorg:mainfrom
ddebasmita-lab:narratives-services-image
Open

Narratives services image#444
ddebasmita-lab wants to merge 2 commits into
datacommonsorg:mainfrom
ddebasmita-lab:narratives-services-image

Conversation

@ddebasmita-lab

Copy link
Copy Markdown
Contributor

Overview

Clear description of the changes.

Dockerfile — a thin overlay on the upstream Custom Data Commons image. Adds the compiled React app at /workspace/react-ui/ and replaces the nginx config; upstream's entrypoint, which supervises nginx, Flask, Mixer, MCP and the NL server, is left untouched.

The React build runs in a node stage inside the image rather than on the host. That keeps a clean clone reproducible — npm ci installs exactly the tree in package-lock.json — and avoids a pre-built dist/ having to be staged first. It also sidesteps .dockerignore, which excludes dist/ and would silently break a host-staged copy.
nginx.conf — routes:

Path Goes to
/agent/* the sidecar on 127.0.0.1:5001
/, /assets/* the React build, from the image
/core/api/* Mixer on :8081, with CORS preflight
/mcp the MCP server on :8082
everything else upstream Flask on :7070

…s /agent

The repo had the agent sidecar but nothing to put in front of it: no container
served the React build, and nothing routed /agent/* to the sidecar. This adds
the second of the two containers in the Cloud Run service.

`Dockerfile` is a thin overlay on the upstream Custom Data Commons image. It
adds the compiled React app at /workspace/react-ui/ and replaces the nginx
config; the upstream entrypoint, which supervises nginx, Flask, Mixer, MCP and
the NL server, is left untouched.

The React build runs in a node stage inside the image rather than on the host.
That keeps a clean clone reproducible — `npm ci` installs exactly the tree in
package-lock.json — and avoids a pre-built dist/ having to be staged in first.
It also sidesteps .dockerignore, which excludes dist/ and would silently break
a host-staged copy.

`nginx.conf` routes:
  /agent/*        -> 127.0.0.1:5001, the sidecar. Buffering and caching are off
                     and chunked encoding is on, without which the chat stream
                     only arrives once the response closes.
  /, /assets/*    -> the React build, served from the image.
  /core/api/*     -> Mixer on :8081, with the CORS preflight it needs.
  /mcp            -> the MCP server on :8082.
  everything else -> upstream Flask on :7070.

The bare-asset allowlist covers exactly the three files public/ ships —
loader.png, send.svg, logo.png — verified against `npm run build` output.

`build.sh` mirrors the reviewed shape of agent/build.sh: resolves its own
directory so the docker context does not depend on the caller's CWD, hoists the
image name into one variable, loops over "$@" rejecting unknown flags, offers
--help, and fails the build if the result is not amd64.

`.dockerignore` gains agent/ and config/, neither of which the React build
reads. The patterns match the context root only, so src/config/ is unaffected.

This image deliberately keeps upstream's runtime user rather than dropping to a
non-root one, unlike the agent sidecar. The reasoning is recorded in the
Dockerfile: the entrypoint supervises five processes and owns its filesystem
layout, and nothing this overlay adds needs write access at runtime.
… image

Pinning `--platform=linux/amd64` on the FROM line trips BuildKit's
FromPlatformFlagConstDisallowed warning and would break a multi-platform build.
It was also redundant: build.sh already passes `--platform linux/amd64` and
fails the build if the result is not amd64.

Verified by building on an arm64 host: the image cross-builds cleanly, the arch
check passes, and the warning is gone.
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

Gemini encountered an error creating the review. You can try again by commenting /gemini review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant