Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ ENV PATH="/opt/venv/bin:$PATH" \
RUN chown -R mcpuser:mcpuser /app /opt/venv

# 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}


# Environment variables with stdio defaults (override for network mode)
ENV CB_MCP_READ_ONLY_QUERY_MODE="true" \
Expand Down