Stefan Allen commited on
Commit
28f7956
·
1 Parent(s): e16a332

Fix: Use /app/data for storage directory

Browse files

- Changed from /data to /app/data (more reliable in Docker)
- Added proper permissions in Dockerfile
- Should fix sqlite database creation error

Files changed (2) hide show
  1. Dockerfile +2 -2
  2. app.py +3 -3
Dockerfile CHANGED
@@ -11,8 +11,8 @@ RUN pip install --no-cache-dir -r requirements.txt
11
  # Copy application code
12
  COPY app.py .
13
 
14
- # Create data directory for persistent storage
15
- RUN mkdir -p /data
16
 
17
  # Expose port 7860 (HuggingFace standard)
18
  EXPOSE 7860
 
11
  # Copy application code
12
  COPY app.py .
13
 
14
+ # Create data directory with proper permissions
15
+ RUN mkdir -p /app/data && chmod 777 /app/data
16
 
17
  # Expose port 7860 (HuggingFace standard)
18
  EXPOSE 7860
app.py CHANGED
@@ -13,9 +13,9 @@ import base64
13
  import asyncio
14
  from typing import Dict, Set
15
 
16
- # Persistent storage directory (HF Spaces persistent storage)
17
- STORAGE_DIR = Path("/data") if Path("/data").exists() else Path("./data")
18
- STORAGE_DIR.mkdir(exist_ok=True)
19
  DB_PATH = STORAGE_DIR / "framepeer.db"
20
 
21
  # Phantom peer ID
 
13
  import asyncio
14
  from typing import Dict, Set
15
 
16
+ # Persistent storage directory
17
+ STORAGE_DIR = Path("./data")
18
+ STORAGE_DIR.mkdir(exist_ok=True, parents=True)
19
  DB_PATH = STORAGE_DIR / "framepeer.db"
20
 
21
  # Phantom peer ID