feat(docker): heidi-cli image with bundled UI#81
Conversation
Summary of ChangesHello @heidi-dang, 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 a significant enhancement to the Highlights
Changelog
Activity
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
Code Review
This pull request adds a multi-stage Docker build to bundle the Vite-based UI with the heidi-cli application, which is a great enhancement. The overall structure of the Dockerfile is good. My review provides suggestions to align the Dockerfile with best practices for creating smaller, more secure, and reproducible container images. This includes pinning base image versions, avoiding broad COPY commands, and using standard package installation methods for production images.
|
|
||
| COPY --from=ui-builder /app/ui/dist /app/heidi_cli/ui_dist | ||
|
|
||
| COPY . . |
There was a problem hiding this comment.
The COPY . . command copies the entire build context into the image, including files not needed for runtime like the ui source, development scripts, and the Dockerfile itself. This unnecessarily increases the final image size and can be a security risk. It is strongly recommended to use a .dockerignore file to exclude these files, or replace this with specific COPY commands for only the necessary application source code (e.g., COPY src ./src and COPY pyproject.toml .).
| @@ -1,3 +1,13 @@ | |||
| FROM node:22-alpine AS ui-builder | |||
There was a problem hiding this comment.
For more reproducible and secure builds, it's a best practice to pin the base image to a specific version (e.g., node:22.4.0-alpine) rather than using a floating tag like 22-alpine. This prevents unexpected changes or build failures if the base image tag is updated.
FROM node:22.4.0-alpine AS ui-builder
|
|
||
| COPY . . | ||
|
|
||
| RUN pip install --no-cache-dir -e . |
There was a problem hiding this comment.
An editable install (-e) is suitable for development, but for a production Docker image, a standard installation is preferred. A standard install creates a more immutable and potentially optimized environment, which is desirable for a distributable image. Consider changing this to a standard pip install . for the final image.
RUN pip install --no-cache-dir .
Summary
What Changed
How to Test
docker build -t heididang/heidi-cli:dev . docker run --rm -p 7777:7777 heididang/heidi-cli:dev curl -i http://localhost:7777/health curl -i http://localhost:7777/ui/Notes