Skip to content

fix(ui): grant read and execute permissions to entrypoint script and nginx config in OCI image - #886

Merged
andrzejfudro merged 1 commit into
mainfrom
fix/ui-entrypoint-permissions
Sep 15, 2026
Merged

andrzejfudro merged 1 commit into
mainfrom
fix/ui-entrypoint-permissions

Conversation

@andrzejfudro

@andrzejfudro andrzejfudro commented Sep 15, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Ensures /etc/nginx/conf.d/default.conf has a+r and /docker-entrypoint.d/generate_config.sh has a+rx permissions in the generated UI OCI image. This prevents container startup crashes when running under non-root Kubernetes security contexts.

Motivation & Context

When building container images in host environments with restrictive umasks (such as 027), files copied into the Docker build context do not have read permissions for other users. When the UI container runs in Kubernetes under a non-root securityContext (runAsNonRoot: true, runAsUser: 1000), the entrypoint script /docker-entrypoint.sh is unable to read /docker-entrypoint.d/generate_config.sh and fails with Permission denied, causing continuous container crash loops.

Explicitly setting read permissions on the Nginx configuration and read+execute permissions on the entrypoint script ensures that non-root users can execute the entrypoint script and start Nginx reliably.

Key Changes

  • cmd/ui/build_ui_oci.py: Added RUN chmod a+r /etc/nginx/conf.d/default.conf and updated entrypoint permissions to RUN chmod a+rx /docker-entrypoint.d/generate_config.sh across both pre-compiled and fallback multi-stage build paths.

Assumptions

None — requirements were fully specified.

Verification & Testing

  • Commands Executed: ./.githooks/pre-commit
  • Coverage & Test Status: Pre-commit linters (Buildifier, gofmt, addlicense, Ruff) passed with 0 errors. Verified end-to-end container startup and health in a live Kubernetes environment under non-root security context.

Related Issues / Bugs

N/A

TAG=agy
CONV=e98e0073-5a75-4ef2-9a16-fdd19a94ccb2

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

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 generation in build_ui_oci.py to explicitly set read permissions on the Nginx configuration and execute permissions on the entrypoint script, alongside adding corresponding test assertions in build_ui_oci_test.py. Feedback suggests optimizing the Dockerfile by using the --chmod option directly within the COPY instructions to reduce image layers. Additionally, the reviewer pointed out a fragile command-parsing bug in the test helper that fails when flags like --platform are present, recommending a safer approach that always targets the last element of the command list.

Comment thread cmd/ui/build_ui_oci_test.py Resolved
Comment thread cmd/ui/build_ui_oci_test.py Resolved
Comment thread cmd/ui/build_ui_oci.py Resolved
Comment thread cmd/ui/build_ui_oci.py Resolved
…nginx config in OCI image

Ensure /etc/nginx/conf.d/default.conf has a+r and /docker-entrypoint.d/generate_config.sh has a+rx permissions in the built Docker image.

When building container images in environments with a restrictive umask (such as 027), files copied into the Docker build context lack read permissions for other users. Running under a non-root securityContext (e.g., runAsUser: 1000) caused the entrypoint script execution to fail with 'Permission denied'.

Adding explicit world-read permissions to the Nginx configuration and read+execute permissions to the entrypoint script ensures the container starts reliably across non-root execution environments.

TAG=agy

CONV=e98e0073-5a75-4ef2-9a16-fdd19a94ccb2
@andrzejfudro
andrzejfudro force-pushed the fix/ui-entrypoint-permissions branch from 48b87c8 to 7498514 Compare September 15, 2026 11:59
@andrzejfudro
andrzejfudro marked this pull request as ready for review September 15, 2026 12:15
@andrzejfudro
andrzejfudro added this pull request to the merge queue Sep 15, 2026
Merged via the queue into main with commit 9d2878c Sep 15, 2026
12 checks passed
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.

2 participants