Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Dockerfile for serving containerised frontend #252

Merged
merged 1 commit into from
Aug 8, 2024

Conversation

alexcreasy
Copy link
Contributor

@alexcreasy alexcreasy commented Aug 6, 2024

Description

This PR allows the frontend to be served in a container using nginx and adds:

  • Dockerfile for serving the frontend and proxying calls to the bff.
  • An example docker-compose for running the stack.
  • Webpack config for proxying and url rewriting for the frontend in dev mode.
  • A frontend Makefile for building the docker image

How Has This Been Tested?

  • Run the example docker-compose file: podman compose up -d (swap podman for docker if that's your bag)
  • Verify the frontend loads in a browser at: localhost:8080
  • Verify the reverse proxy to the backend works via curl: curl localhost:8080/api/v1/model-registry/ - this should return a valid response from the bff
  • Run the frontend in dev mode using: npm run start:dev - run the bff directly using make run PORT=4000 MOCK_K8S_CLIENT=true in a separate terminal and verify the dashboard loads in a browser and the proxy functions by running: curl localhost:9000/api/v1/model-registry/.
  • Run the frontend Makefile make CONTAINER_TOOL=podman (leave out the CONTAINER_TOOL param to use docker)

Merge criteria:

  • The commits and have meaningful messages; the author will squash them after approval or will ask to merge with squash.
  • Testing instructions have been added in the PR body (for PRs involving changes that are not immediately obvious).
  • The developer has manually tested the changes and verified that the changes work

Copy link
Contributor

@Griffin-Sullivan Griffin-Sullivan left a comment

Choose a reason for hiding this comment

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

I must be doing something wrong. Everything in the testing works for me except when I run docker compose up -d then go to localhost:8080 it's not working. I'm getting minified react errors so I can't see what the exact cause is. I'm going to keep digging.

Edit: Got it to work. I removed everything and ran npm install before docker compose again. Besides the two comments everything is good to me.

Edit 2: I've tested everything and it works for me. Note about Run the frontend in dev mode using: npm run start:dev - verify this works with proxied backend URLs. If you want to test yourself you need to run the backend separately in the bff dir with the command make run PORT=4000 MOCK_K8S_CLIENT=true.

clients/ui/frontend/config/webpack.dev.js Show resolved Hide resolved
clients/ui/frontend/Dockerfile Outdated Show resolved Hide resolved
@alexcreasy alexcreasy force-pushed the dockerfile branch 2 times, most recently from fe3f8cf to 2cecf7e Compare August 7, 2024 10:20
Copy link
Contributor

@lucferbux lucferbux left a comment

Choose a reason for hiding this comment

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

couple of nits and suggestions

clients/ui/frontend/Dockerfile Show resolved Hide resolved
clients/ui/docker-compose.yaml Show resolved Hide resolved
clients/ui/docker-compose.yaml Show resolved Hide resolved
clients/ui/frontend/nginx.conf Outdated Show resolved Hide resolved
clients/ui/frontend/Dockerfile Show resolved Hide resolved
clients/ui/frontend/nginx.conf Outdated Show resolved Hide resolved
  * Dockerfile for serving the frontend and proxying calls to the bff.
  * An example docker-compose for running the stack.
  * Webpack config for proxying and url rewriting for the frontend in dev mode.
  * A frontend Makefile for building the docker image

Signed-off-by: Alex Creasy <alex@creasy.dev>
@alexcreasy
Copy link
Contributor Author

I've addressed all the feedback given:

  • the proxy no longer uses the /p/ prefix, so you can query using /api/v1/model-registry/ directly. I've updated the instructions in the PR.
  • I've updated the build stage of the container build, it should no longe rely on you having the correct node_modules installed.

Copy link
Contributor

@Griffin-Sullivan Griffin-Sullivan left a comment

Choose a reason for hiding this comment

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

Retested everything and it's working as expected

Copy link
Contributor

@lucferbux lucferbux left a comment

Choose a reason for hiding this comment

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

/lgtm

Copy link

@lucferbux: changing LGTM is restricted to collaborators

In response to this:

/lgtm

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ederign, Griffin-Sullivan, lucferbux

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ederign
Copy link
Member

ederign commented Aug 8, 2024

/lgtm

@google-oss-prow google-oss-prow bot added the lgtm label Aug 8, 2024
@google-oss-prow google-oss-prow bot merged commit 93f542d into kubeflow:main Aug 8, 2024
14 checks passed
dhirajsb added a commit to dhirajsb/model-registry-kfp that referenced this pull request Aug 30, 2024
* chore: Add kind integration test, fixes kubeflow#251

* Remove unused IMG_VERSION env variable in pr build workflow
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants