Skip to content

fix: chown /app before USER node so bun install can write node_modules#5

Open
TPFLegionaire wants to merge 1 commit into
tinyfish-io:mainfrom
TPFLegionaire:fix/frontend-dockerfile-chown
Open

fix: chown /app before USER node so bun install can write node_modules#5
TPFLegionaire wants to merge 1 commit into
tinyfish-io:mainfrom
TPFLegionaire:fix/frontend-dockerfile-chown

Conversation

@TPFLegionaire
Copy link
Copy Markdown

Problem

A fresh make dev fails on the frontend image build with:

#18 [frontend 5/6] RUN bun install
#18 0.200 bun install v1.3.14 (0d9b296a)
#18 0.208 EACCES: Permission denied: could not create the "node_modules" directory (mkdir)
#18 ERROR: process "/bin/sh -c bun install" did not complete successfully: exit code: 1

Cause

frontend/Dockerfile.dev does:

WORKDIR /app
RUN npm install -g bun
COPY --chown=node:node package.json bun.lock ./
USER node
RUN bun install

WORKDIR /app creates /app owned by root. USER node drops privileges before bun install, but /app itself is still root-owned, so bun cannot create node_modules inside it. COPY --chown=node:node only fixes the copied files, not the parent directory.

Fix

Chown /app to node in the same RUN that installs bun:

RUN npm install -g bun && chown node:node /app

One-line change. No new layers.

Verification

make dev succeeds on a fresh clone; frontend starts and Ready in 600ms shows in logs.

WORKDIR creates /app owned by root. USER node is set before bun install,
so bun cannot create node_modules in /app and the build fails with:

    EACCES: Permission denied: could not create the "node_modules"
    directory (mkdir)

Chown /app to node in the same RUN that installs bun, then proceed.
COPY --chown=node:node already handles the files, but the directory
itself needs to be writable too.

Repro: `make dev` on a fresh clone.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 16, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9fc0f3c0-640a-44b3-beab-9a2177c9f7f5

📥 Commits

Reviewing files that changed from the base of the PR and between 4552227 and f5720c8.

📒 Files selected for processing (1)
  • frontend/Dockerfile.dev

📝 Walkthrough

Walkthrough

The frontend/Dockerfile.dev build step has been updated to execute two operations in a single RUN command: globally installing bun and then changing the ownership of the /app directory to the node user and group. Previously, only the bun installation was performed in this step.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: adding a chown command to fix permission issues before switching to the node user.
Description check ✅ Passed The description thoroughly explains the problem, root cause, solution, and verification steps, all directly related to the changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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