chenx906 commited on
Commit
95ec74e
·
1 Parent(s): 7ed8f5e

Fix the deployment space problem

Browse files
Files changed (1) hide show
  1. Dockerfile +10 -18
Dockerfile CHANGED
@@ -1,32 +1,24 @@
1
  FROM python:3.9-slim
2
 
3
- # --- 1. Create user and working directory ---
4
  RUN useradd -m -u 1000 user
5
  WORKDIR /app
6
 
7
- # --- 2. Install dependencies ---
8
  COPY requirements.txt .
9
  RUN pip install --no-cache-dir -r requirements.txt
10
- RUN pip install fastapi uvicorn python-multipart requests
 
11
 
12
- # --- 3. Copy your backend code ---
13
  COPY --chown=user:user . .
14
 
15
- # --- 4. Create API directory and copy your app.py into it ---
16
- RUN mkdir -p api
17
- COPY app.py api/app.py
18
-
19
- # --- 5. Copy UI (last to force rebuild when changed) ---
20
- RUN mkdir -p ui
21
- COPY ui/ ./ui/
22
-
23
- # Optional: small cache-buster to ensure rebuilds update UI
24
- RUN echo "UI_BUILD_TS=$(date +%s)" > /app/ui/.buildtag
25
-
26
- # --- 6. Permissions and start ---
27
  RUN chown -R user:user /app
28
  USER user
 
 
29
  EXPOSE 7860
30
 
31
- # --- 7. Run FastAPI ---
32
- CMD ["uvicorn", "api.app:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
  FROM python:3.9-slim
2
 
3
+ # 1) Create user & workdir
4
  RUN useradd -m -u 1000 user
5
  WORKDIR /app
6
 
7
+ # 2) Install deps
8
  COPY requirements.txt .
9
  RUN pip install --no-cache-dir -r requirements.txt
10
+ # Gradio is required by your api/app.py
11
+ RUN pip install gradio torch pillow requests
12
 
13
+ # 3) Copy your project
14
  COPY --chown=user:user . .
15
 
16
+ # 4) Permissions & user
 
 
 
 
 
 
 
 
 
 
 
17
  RUN chown -R user:user /app
18
  USER user
19
+
20
+ # 5) Expose Hugging Face Spaces port
21
  EXPOSE 7860
22
 
23
+ # 6) Run your Gradio app directly (NOT uvicorn)
24
+ CMD ["python", "api/app.py"]