sitcod3 commited on
Commit
36d00fe
·
verified ·
1 Parent(s): 9fa7eea

fix: writable runtime dirs for UID 1000 (PROFILE_ACCESS_DENIED)

Browse files
Files changed (1) hide show
  1. Dockerfile +12 -3
Dockerfile CHANGED
@@ -18,9 +18,18 @@ COPY src/ ./src/
18
  RUN pip install --no-cache-dir . \
19
  && pip install --no-cache-dir "playwright==1.48.0"
20
 
21
- # Non-root runtime; profiles + screenshots live on /data (persistent storage
22
- # mounts here when enabled, otherwise ephemeral container disk).
23
- RUN useradd -m appuser && mkdir -p /data/profiles && chown -R appuser:appuser /data
 
 
 
 
 
 
 
 
 
24
  USER appuser
25
 
26
  ENV BROWSER_USER_DATA_DIR=/data/profiles \
 
18
  RUN pip install --no-cache-dir . \
19
  && pip install --no-cache-dir "playwright==1.48.0"
20
 
21
+ # Non-root runtime matching HF Spaces (process runs as UID 1000):
22
+ # - appuser pinned to UID 1000 (-o: tolerate an existing 1000 in the base image)
23
+ # - /data/profiles = browser profiles (persistent storage mounts at /data)
24
+ # - /app/.browser-runtime = the manager's runtime-root fallback; it MUST exist
25
+ # and be writable before boot, else _prepare_runtime() dies resolving a
26
+ # writable browser storage directory (observed as PROFILE_ACCESS_DENIED on
27
+ # HF: neither /usr/local/lib/python3.12/.browser-runtime nor /app/... was
28
+ # writable). chown 1000 + chmod 777 keeps any runtime UID working.
29
+ RUN useradd -o -u 1000 -m appuser \
30
+ && mkdir -p /data/profiles /app/.browser-runtime \
31
+ && chown -R 1000:1000 /data /app/.browser-runtime \
32
+ && chmod -R 777 /data /app/.browser-runtime
33
  USER appuser
34
 
35
  ENV BROWSER_USER_DATA_DIR=/data/profiles \