Skip to content

fix: Dockerfile HuggingFace cache and generations directory permissions - #1017

Open
virtuallyunknown wants to merge 1 commit into
jamiepine:mainfrom
virtuallyunknown:fix-dockerfile-directory-permissions
Open

fix: Dockerfile HuggingFace cache and generations directory permissions#1017
virtuallyunknown wants to merge 1 commit into
jamiepine:mainfrom
virtuallyunknown:fix-dockerfile-directory-permissions

Conversation

@virtuallyunknown

@virtuallyunknown virtuallyunknown commented Aug 9, 2026

Copy link
Copy Markdown

Fixes #542

Summary by CodeRabbit

  • Bug Fixes
    • Improved container setup by ensuring required cache and voice-generation directories are available with the correct permissions at runtime.

@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The Dockerfile now creates the HuggingFace cache and voice-generation directories before application setup. It assigns both directories to the voicebox user.

Changes

Docker runtime directory permissions

Layer / File(s) Summary
Runtime directory setup
Dockerfile
Creates /home/voicebox/.cache/huggingface and /app/data/generations, then assigns ownership to voicebox.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related PRs

Suggested reviewers: sridhar-3009

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the Dockerfile permission fix for the HuggingFace cache and generations directories.
Linked Issues check ✅ Passed The Dockerfile creates the required directories and assigns ownership to voicebox, addressing the permission issue in #542.
Out of Scope Changes check ✅ Passed All reported changes support the Docker directory permission objectives in #542, with no unrelated changes identified.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

Warning

⚠️ This pull request shows signs of AI-generated slop (redundant_comments). It has been flagged by CodeRabbit slop detection and should be reviewed carefully.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
Dockerfile (1)

81-83: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Remove the duplicate generations setup.

Lines 103-105 already create /app/data/generations and assign /app/data to voicebox. This block adds an unnecessary image layer and does not improve permissions for mounted paths.

Proposed cleanup
-# Create voice generations directory for the named volume
-RUN mkdir -p /app/data/generations \
-    && chown -R voicebox:voicebox /app/data/generations
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Dockerfile` around lines 81 - 83, Remove the duplicate generations directory
setup block from the Dockerfile, including its mkdir and chown commands. Keep
the existing setup later in the Dockerfile that creates /app/data/generations
and assigns ownership of /app/data to voicebox.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@Dockerfile`:
- Around line 77-83: Move runtime ownership initialization for
/home/voicebox/.cache/huggingface and /app/data/generations from the Dockerfile
into scripts/rocm-entrypoint.sh, after GPU setup and before the gosu voicebox
handoff. Ensure the entrypoint creates missing mount paths and migrates existing
bind mounts or named volumes to the voicebox UID/GID before starting the
application, including handling volumes that retain incorrect ownership.

---

Nitpick comments:
In `@Dockerfile`:
- Around line 81-83: Remove the duplicate generations directory setup block from
the Dockerfile, including its mkdir and chown commands. Keep the existing setup
later in the Dockerfile that creates /app/data/generations and assigns ownership
of /app/data to voicebox.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: e81270e2-882d-48a0-ada9-a274aac7d7ea

📥 Commits

Reviewing files that changed from the base of the PR and between 51f49de and 37c9470.

📒 Files selected for processing (1)
  • Dockerfile

Comment thread Dockerfile
Comment on lines +77 to +83
# Create HuggingFace cache directory for the named volume
RUN mkdir -p /home/voicebox/.cache/huggingface \
&& chown -R voicebox:voicebox /home/voicebox/.cache/huggingface

# Create voice generations directory for the named volume
RUN mkdir -p /app/data/generations \
&& chown -R voicebox:voicebox /app/data/generations

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== files =="
git ls-files | rg '(^Dockerfile$|docker-compose|^scripts/rocm-entrypoint\.sh$)'

echo
echo "== Dockerfile relevant sections =="
if [ -f Dockerfile ]; then
  nl -ba Dockerfile | sed -n '1,140p'
fi

echo
echo "== compose mounts =="
for f in docker-compose.yml docker-compose.yaml; do
  [ -f "$f" ] && { echo "--- $f"; nl -ba "$f" | sed -n '1,180p'; }
done

echo
echo "== entrypoint relevant snippets =="
for f in scripts/rocm-entrypoint.sh; do
  [ -f "$f" ] && { echo "--- $f"; nl -ba "$f" | sed -n '1,220p'; }
done

echo
echo "== search ownership/mount hints =="
rg -n "generations|huggingface|voi(cebox|ce)|chown|mkdir -p|rocm-entrypoint|compose" .

Repository: jamiepine/voicebox

Length of output: 326


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== line ranges for relevant files =="
for f in Dockerfile docker-compose.sh docker-compose.yml docker-compose.rocm.yml scripts/rocm-entrypoint.sh; do
  if [ -f "$f" ]; then
    echo "--- $f"
    wc -l "$f"
    sed -n '1,220p' "$f"
  fi
done

echo "== searches =="
rg -n "generations|huggingface|voicebox|huggingface-cache|output|chown|mkdir -p|rocm-entrypoint|entrypoint" . || true

echo "== script executable bits =="
find . -maxdepth 3 \( -name 'Dockerfile' -o -name 'docker-compose*.yml' -o -name 'rocm-entrypoint.sh' \) -exec ls -la {} \; 2>/dev/null || true

Repository: jamiepine/voicebox

Length of output: 50375


Initialize runtime-owned mount paths as voicebox before applying the volume migrations.

The image ownership at lines 77-83 and 104-105 does not apply to bind-mounted host directories like ./output:/app/data/generations, and existing named volumes can retain wrong ownership after the chown migrations. Run the runtime mount path initialization in scripts/rocm-entrypoint.sh after GPUs are handled but before gosu voicebox, and ensure existing volumes are migrated or recreated with the voicebox UID/GID.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Dockerfile` around lines 77 - 83, Move runtime ownership initialization for
/home/voicebox/.cache/huggingface and /app/data/generations from the Dockerfile
into scripts/rocm-entrypoint.sh, after GPU setup and before the gosu voicebox
handoff. Ensure the entrypoint creates missing mount paths and migrates existing
bind mounts or named volumes to the voicebox UID/GID before starting the
application, including handling volumes that retain incorrect ownership.

@virtuallyunknown

virtuallyunknown commented Aug 9, 2026

Copy link
Copy Markdown
Author

⚠️ This pull request shows signs of AI-generated slop (redundant_comments). It has been flagged by CodeRabbit slop detection and should be reviewed carefully.

It's following the existing Dockerfile conventions of having a comment before each significant instruction. And the code/fix itself is taken from #542.

No AI was involved in the making of this.

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.

Docker - Could not create HuggingFace cache directory

1 participant