Skip to content

Conversation

ReSearchITEng
Copy link

fix runAsUser using UID, fixing #56

Copy link
Contributor

Summary of Changes

Hello @ReSearchITEng, 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 implements a fix for an identified issue by modifying the Dockerfile to specify the user for container execution using a numeric User ID (UID) rather than a username. This ensures more robust and consistent behavior, particularly in environments where runAsUser relies on UID for proper operation, thereby resolving issue #56.

Highlights

  • Dockerfile User Configuration: The USER instruction in the Dockerfile has been updated to use the numeric User ID (UID) 1001 instead of the username mcpuser. This change directly addresses an issue where runAsUser might not function correctly when a username is specified.
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

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 updates the Dockerfile to use the user's UID instead of the username in the USER instruction. This is a good practice for improving security and compatibility with container orchestration platforms. I've added one comment with a suggestion to further improve maintainability by using build arguments to define the user and UID, which would avoid hardcoding these values and make them easier to manage.


# Switch to non-root user
USER mcpuser
USER 1001
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Using the UID directly is a good practice for container security and compatibility. However, the UID 1001 is now hardcoded in two places (here and in the useradd command on line 33). This could lead to maintenance issues if the UID needs to be changed in the future.

To improve maintainability, consider defining the username and UID as build arguments (ARG) and using these variables throughout the Dockerfile. This centralizes the user configuration, making it easier to modify.

For example:

ARG USER_NAME=mcpuser
ARG USER_UID=1001
...
RUN useradd --system --uid ${USER_UID} ${USER_NAME}
...
RUN chown -R ${USER_NAME}:${USER_NAME} /app /opt/venv
...
USER ${USER_UID}

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