Skip to content

[DCP Deployment] Update Dockerfile for UV pinning & nonroot access#18

Open
gmechali wants to merge 3 commits intodatacommonsorg:mainfrom
gmechali:safepush
Open

[DCP Deployment] Update Dockerfile for UV pinning & nonroot access#18
gmechali wants to merge 3 commits intodatacommonsorg:mainfrom
gmechali:safepush

Conversation

@gmechali
Copy link
Contributor

Also makes a small change to the cloudbuild to use the SHORT_SHA notation that github supports for the triggers to catch the git commit hash.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, 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 focuses on improving the robustness and security of the Docker image build process and streamlining the continuous integration pipeline. It ensures that dependencies are consistently resolved by pinning versions and enhances container security by running applications as a non-root user. Additionally, it refines the image tagging strategy in Cloud Build for better integration with GitHub's commit hash notation.

Highlights

  • Dockerfile Updates: The Dockerfile has been updated to pin the uv dependency to a specific version (0.9.10) for improved reproducibility and to introduce a non-root user (datacommons-runner) for enhanced security.
  • Cloud Build Configuration: The cloudbuild.yaml configuration was modified to utilize the SHORT_SHA notation instead of COMMIT_SHA for tagging Docker images, aligning with GitHub's support for shorter commit hashes in triggers.
Changelog
  • build/Dockerfile
    • Pinned the uv dependency to version 0.9.10 from latest for reproducibility.
    • Modified the uv sync command to simplify dependency installation.
    • Added a new non-root user and group (datacommons-runner) and switched to this user for running the application, improving container security.
  • build/cloudbuild.yaml
    • Updated image tagging from $COMMIT_SHA to $SHORT_SHA to leverage GitHub's short commit hash notation.
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
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 several good improvements to the deployment artifacts. Pinning the uv version in the Dockerfile enhances reproducibility. Consolidating the uv sync commands makes the Docker build more efficient by reducing a layer. The most significant change is the introduction of a non-root user, which is a crucial security best practice for containers. The change in cloudbuild.yaml to use SHORT_SHA is also a good refinement for image tagging. I have one suggestion to further improve the security and robustness of the user creation in the Dockerfile.

@gmechali gmechali requested a review from dwnoble March 12, 2026 20:10
@gmechali gmechali requested a review from clincoln8 March 12, 2026 20:56
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