Zayne Rea Sprague Claude Opus 4.6 commited on
Commit
d989e09
·
1 Parent(s): 86f6a2a

fix: create writable data directories in Docker for HF Spaces

Browse files

HF Spaces runs as non-root user. The backend/data/ directory
(for experiment storage) wasn't in git, so mkdir at runtime
would fail. Pre-create with 777 perms during build. Also fix
.dockerignore to recursively exclude __pycache__.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Files changed (2) hide show
  1. .dockerignore +3 -2
  2. Dockerfile +4 -0
.dockerignore CHANGED
@@ -2,6 +2,7 @@ node_modules
2
  frontend/node_modules
3
  frontend/dist
4
  .git
5
- __pycache__
6
- *.pyc
7
  .env
 
 
2
  frontend/node_modules
3
  frontend/dist
4
  .git
5
+ **/__pycache__
6
+ **/*.pyc
7
  .env
8
+ backend/data
Dockerfile CHANGED
@@ -22,6 +22,10 @@ RUN pip install --no-cache-dir -r backend/requirements.txt
22
  # Copy backend code
23
  COPY backend/ ./backend/
24
 
 
 
 
 
25
  # Copy built frontend from build stage
26
  COPY --from=frontend-build /app/frontend/dist ./frontend/dist/
27
 
 
22
  # Copy backend code
23
  COPY backend/ ./backend/
24
 
25
+ # Create writable data directories for runtime (HF Spaces runs as non-root)
26
+ RUN mkdir -p /app/backend/data /app/backend/presets && \
27
+ chmod -R 777 /app/backend/data /app/backend/presets
28
+
29
  # Copy built frontend from build stage
30
  COPY --from=frontend-build /app/frontend/dist ./frontend/dist/
31