KiWA001 commited on
Commit
b3ece15
·
1 Parent(s): 8a10c65

debug: run as root and add startup logs

Browse files
Files changed (2) hide show
  1. Dockerfile +10 -11
  2. main.py +5 -0
Dockerfile CHANGED
@@ -21,17 +21,16 @@ RUN playwright install chromium
21
  # Copy application code
22
  COPY . .
23
 
24
- # Create a non-root user (Hugging Face Spaces requirement)
25
- # UID 1000 is taken by the base image, so we use 1001
26
- RUN useradd -m -u 1001 user
27
-
28
- # Ensure the user owns the application directory
29
- # This is CRITICAL for g4f/playwright to write temporary files/caches
30
- RUN chown -R user:user /app
31
-
32
- USER user
33
- ENV HOME=/home/user
34
- ENV PATH=$HOME/.local/bin:$PATH
35
 
36
  # Expose the port (Hugging Face uses 7860 by default)
37
  EXPOSE 7860
 
21
  # Copy application code
22
  COPY . .
23
 
24
+ # Remove user creation for debugging permissions
25
+ # RUN useradd -m -u 1001 user
26
+ # RUN chown -R user:user /app
27
+ # USER user
28
+ # ENV HOME=/home/user
29
+ # ENV PATH=$HOME/.local/bin:$PATH
30
+
31
+ # Run as root for now to fix 404 crash
32
+ ENV HOME=/root
33
+ ENV PATH=/root/.local/bin:$PATH
 
34
 
35
  # Expose the port (Hugging Face uses 7860 by default)
36
  EXPOSE 7860
main.py CHANGED
@@ -8,6 +8,11 @@ Run with: uvicorn main:app --host 0.0.0.0 --port 8000
8
  """
9
 
10
  import os
 
 
 
 
 
11
 
12
  # Fix for Vercel Read-Only File System
13
  # Must be set BEFORE importing g4f or engine
 
8
  """
9
 
10
  import os
11
+ import sys
12
+
13
+ print("🔥 STARTING K-AI API... 🔥", file=sys.stderr)
14
+ print(f"Current Working Directory: {os.getcwd()}", file=sys.stderr)
15
+ print(f"Directory Contents: {os.listdir('.')}", file=sys.stderr)
16
 
17
  # Fix for Vercel Read-Only File System
18
  # Must be set BEFORE importing g4f or engine