Skip to content

fix: replace yarn wrapper with ENV vars in Containerfile#5

Merged
durandom merged 1 commit into
mainfrom
fix/containerfile-env-vars
Jun 10, 2026
Merged

fix: replace yarn wrapper with ENV vars in Containerfile#5
durandom merged 1 commit into
mainfrom
fix/containerfile-env-vars

Conversation

@durandom

@durandom durandom commented Jun 10, 2026

Copy link
Copy Markdown
Member

Summary

The old approach wrote a bash wrapper that hardcoded COREPACK_HOME and called exec /usr/bin/corepack yarn. This broke because:

  1. /usr/local/share/corepack is under /usr which is read-only at runtime
  2. The wrapper overwrote corepack's own shim, breaking the standard dispatch chain
  3. Env vars set in the wrapper weren't inherited by git hook subprocesses (husky)

Now corepack's own shim is the only yarn on PATH, and everything is configured via ENV / runtime env files.

Test plan

  • podman build -t rhdh-fullsend-code:local -f images/code/Containerfile images/code/
  • podman run --rm rhdh-fullsend-code:local bash -c 'echo $COREPACK_HOME'/tmp/corepack
  • podman run --rm rhdh-fullsend-code:local yarn --version → version without wrapper
  • podman run --rm rhdh-fullsend-code:local bash -c 'file /usr/local/bin/yarn' → corepack shim, not script

🤖 Generated with Claude Code

- Remove custom yarn wrapper script that overwrote corepack's shim
- Set COREPACK_HOME=/tmp/corepack (writable under every sandbox policy)
- Add YARN_HTTP_PROXY/YARN_HTTPS_PROXY for OpenShell proxy

Fixes #1, fixes #2, fixes #3.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@durandom durandom requested a review from kadel as a code owner June 10, 2026 09:06
Copilot AI review requested due to automatic review settings June 10, 2026 09:06
@durandom durandom merged commit b20169e into main Jun 10, 2026
2 checks passed

Copilot AI 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.

Pull request overview

This PR updates the images/code sandbox image build to rely on ENV configuration rather than a custom yarn wrapper script, aiming to make corepack/yarn work reliably under read-only sandbox filesystem policies and ensure proxy settings are inherited by subprocesses.

Changes:

  • Removes the custom /usr/local/bin/yarn wrapper in favor of corepack’s own shim.
  • Sets COREPACK_HOME=/tmp/corepack to avoid read-only /usr paths at runtime.
  • Bakes Yarn proxy configuration into the image via YARN_HTTP_PROXY / YARN_HTTPS_PROXY.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread images/code/Containerfile
Comment on lines 37 to 40
RUN mkdir -p "$COREPACK_HOME" \
&& corepack enable \
&& corepack prepare yarn@stable --activate \
&& yarn --version
Comment thread images/code/Containerfile
Comment on lines +30 to +35
# COREPACK_HOME=/tmp/corepack — writable under every sandbox policy.
# YARN_HTTP(S)_PROXY — hardcoded OpenShell proxy; inherited by all child
# processes (including git hook subprocesses), replacing the old wrapper.
ENV COREPACK_HOME=/tmp/corepack
ENV YARN_HTTP_PROXY=http://10.200.0.1:3128
ENV YARN_HTTPS_PROXY=http://10.200.0.1:3128
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.

COREPACK_HOME points to read-only path at sandbox runtime

2 participants