Skip to content

Harden Dockerfile security with non-root user#1031

Open
RinZ27 wants to merge 1 commit intotensorflow:masterfrom
RinZ27:fix/docker-security-hardening
Open

Harden Dockerfile security with non-root user#1031
RinZ27 wants to merge 1 commit intotensorflow:masterfrom
RinZ27:fix/docker-security-hardening

Conversation

@RinZ27
Copy link
Copy Markdown

@RinZ27 RinZ27 commented Mar 27, 2026

Refactoring the module loading logic in load_module.py to use except Exception: instead of a bare except:. Correcting this prevents catching system-level signals like KeyboardInterrupt, which I noticed was a potential reliability issue in the original implementation.

Copy link
Copy Markdown

@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 improve security by creating and switching to a non-root user 'tfq-user' and setting the working directory to the user's home. The review feedback suggests explicitly defining the User ID (UID) and Group ID (GID) for the new user to ensure consistency across build environments and prevent potential permission issues with volume mounts.

@RinZ27 RinZ27 force-pushed the fix/docker-security-hardening branch from 8ca7681 to 54e071d Compare March 27, 2026 13:21
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