Skip to content

Conversation

@ELK4N4
Copy link
Contributor

@ELK4N4 ELK4N4 commented Nov 10, 2025

Summary

This PR adds dockerfile for the koku-ui-onprem application with nginx as the web server.

Changes

  • Added apps/koku-ui-onprem/Dockerfile: Multi-stage build that:

    • Builds the React application using Node.js
    • Serves the built application using nginx from Red Hat registry
    • Configures nginx with environment variable substitution for API proxy URL
  • Added apps/koku-ui-onprem/nginx.conf.template: Nginx configuration that:

    • Proxies /api requests to a configurable backend URL via API_PROXY_URL environment variable
    • Serves the React SPA with proper routing support (fallback to index.html)
    • Preserves the original Host header for proper proxy behavior

Usage

Build and run the Docker container:

docker build -t koku-ui-onprem -f apps/koku-ui-onprem/Dockerfile .
docker run -p 8080:8080 -e API_PROXY_URL=http://your-api-server:8000 koku-ui-onprem

The application will be available at http://localhost:8080 and API requests to /api/* will be proxied to the URL specified in API_PROXY_URL.

Testing

  • Docker build completes successfully
  • Application serves correctly on port 8080
  • API proxy works correctly with configured API_PROXY_URL
  • SPA routing works (direct URL access falls back to index.html)

Summary by Sourcery

Provide containerized deployment of the koku-ui-onprem application with Docker and Nginx, supporting environment-based API proxying and SPA routing fallback

New Features:

  • Add multi-stage Dockerfile to build the React app and serve it with Nginx from the Red Hat registry
  • Introduce nginx.conf.template for runtime environment variable substitution, API proxying, SPA routing fallback, and host header preservation

@sourcery-ai
Copy link

sourcery-ai bot commented Nov 10, 2025

Reviewer's Guide

Adds Docker support for the koku-ui-onprem React application by introducing a multi-stage Dockerfile using Node.js and RHEL Nginx, a templated nginx configuration for API proxying and SPA routing, and updates the package-lock.json for dependency alignment.

Sequence diagram for API proxying via nginx in Docker container

sequenceDiagram
    participant User
    participant Nginx
    participant API_Backend
    User->>Nginx: HTTP GET /api/resource
    Nginx->>API_Backend: Proxy /api/resource to API_PROXY_URL
    API_Backend-->>Nginx: Response
    Nginx-->>User: Response
Loading

File-Level Changes

Change Details Files
Introduce Dockerfile with multi-stage build and dynamic runtime configuration
  • Use node:20-alpine as build stage to install dependencies and build the React app
  • Switch to registry.redhat.io/rhel10/nginx-126 for serving static files
  • Copy nginx template and built artifacts into the final image
  • Expose port 8080 and use envsubst in CMD to inject API_PROXY_URL into nginx.conf
apps/koku-ui-onprem/Dockerfile
Add nginx.conf.template for API proxying and SPA routing
  • Proxy requests under /api to backend defined by API_PROXY_URL environment variable
  • Fallback to index.html for proper single-page application routing
  • Preserve original Host header when proxying requests
apps/koku-ui-onprem/nginx.conf.template
Update dependency lock file to include new onprem application packages
  • Regenerate package-lock.json to incorporate @koku-ui/koku-ui-onprem workspace dependencies
  • Ensure consistency of locked versions for the new build environment
package-lock.json

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @ELK4N4, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces comprehensive Docker support for the koku-ui-onprem React application. It provides a multi-stage Dockerfile to build the application and serve it efficiently using an Nginx web server. The setup includes dynamic API proxying via environment variables and robust handling for single-page application routing, significantly simplifying deployment and configuration in containerized environments.

Highlights

  • Dockerfile Introduction: A new multi-stage Dockerfile has been added for the koku-ui-onprem application, streamlining its containerization process.
  • Nginx Integration: Nginx is now used as the web server within the Docker container, serving the built React application efficiently.
  • Configurable API Proxy: The Nginx configuration includes an API proxy for /api requests, which can be dynamically configured via the API_PROXY_URL environment variable.
  • SPA Routing Support: The Nginx setup ensures proper routing for the Single Page Application (SPA), falling back to index.html for client-side routes.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes - here's some feedback:

  • Consider pinning the Node and NGINX base images to specific digests or patch versions to ensure reproducible builds.
  • For better container security, switch the NGINX process to run as a non-root user instead of root.
  • Add a Docker HEALTHCHECK instruction to proactively verify that the SPA and API proxy are up after startup.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider pinning the Node and NGINX base images to specific digests or patch versions to ensure reproducible builds.
- For better container security, switch the NGINX process to run as a non-root user instead of root.
- Add a Docker HEALTHCHECK instruction to proactively verify that the SPA and API proxy are up after startup.

## Individual Comments

### Comment 1
<location> `PR_DESCRIPTION.md:41` </location>
<code_context>
+- `a5fd6c02a` - lint dockerfile
+- `8c6435aca` - remove exec from cmd
+- `fff94b2ed` - add proxy to /api with env config
+- `ee0eb2168` - optimzied dockerfile and support SPA routing
+- `a67797f9c` - init basic dockerfile and nginx
+
</code_context>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@ELK4N4 ELK4N4 force-pushed the koku-ui-onprem/dockerfile branch from aa5d79d to fc388ba Compare November 10, 2025 09:07
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces Docker support for the koku-ui-onprem application using a multi-stage build with Nginx, which is a great step towards modern deployment practices. The implementation is solid, using an official Red Hat Nginx image and a runtime configuration for the API proxy. My review includes a few suggestions to enhance security and robustness:

  • Dockerfile: Run the Nginx process as a non-root user and ensure proper signal handling for graceful container shutdowns.
  • Nginx Configuration: Add standard proxy headers to provide more context to the backend API and include common security headers to harden the application.

These changes will make the containerized application more secure and production-ready.

@codecov
Copy link

codecov bot commented Nov 10, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.82%. Comparing base (a7ffd0c) to head (bea6ec5).
⚠️ Report is 34 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4598   +/-   ##
=======================================
  Coverage   88.82%   88.82%           
=======================================
  Files         480      480           
  Lines        9075     9075           
  Branches     2198     2197    -1     
=======================================
  Hits         8061     8061           
+ Misses        954      953    -1     
- Partials       60       61    +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@project-koku project-koku deleted a comment from sourcery-ai bot Nov 10, 2025
@ELK4N4 ELK4N4 self-assigned this Nov 10, 2025
@ELK4N4 ELK4N4 requested a review from rawagner November 10, 2025 10:07
Copy link
Contributor

@rawagner rawagner left a comment

Choose a reason for hiding this comment

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

Lets rename the file to Containerfile

@ELK4N4 ELK4N4 force-pushed the koku-ui-onprem/dockerfile branch from acd1bd4 to c8f0e77 Compare November 10, 2025 13:41
@ELK4N4 ELK4N4 closed this Nov 12, 2025
@ELK4N4 ELK4N4 reopened this Nov 12, 2025
@ELK4N4 ELK4N4 requested a review from a team as a code owner November 12, 2025 14:46
@rawagner rawagner merged commit bf1c15a into project-koku:main Nov 12, 2025
14 checks passed
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.

2 participants