CyberCoder225 commited on
Commit
537ad46
·
verified ·
1 Parent(s): ceba766

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +13 -35
Dockerfile CHANGED
@@ -1,43 +1,21 @@
 
1
  FROM python:3.10-slim
2
 
3
- # ---- HF-required environment ----
4
- ENV PYTHONUNBUFFERED=1 \
5
- PORT=7860
6
-
7
- # ---- System deps ----
8
  RUN apt-get update && apt-get install -y \
9
- git \
10
- build-essential \
11
- curl \
12
  && rm -rf /var/lib/apt/lists/*
13
 
14
- # ---- Create non-root user (MANDATORY for HF) ----
15
- RUN useradd -m -u 1000 user
16
-
17
- # ---- App directory ----
18
- WORKDIR /home/user/app
19
 
20
- # ---- Copy project files ----
 
21
  COPY . .
22
 
23
- # ---- Fix permissions ----
24
- RUN chown -R user:user /home/user/app
25
-
26
- # ---- Switch to non-root ----
27
- USER user
28
-
29
- # ---- Python deps (CPU-safe) ----
30
- RUN pip install --no-cache-dir --upgrade pip && \
31
- pip install --no-cache-dir \
32
- fastapi \
33
- uvicorn \
34
- transformers \
35
- sentencepiece \
36
- llama-cpp-python \
37
- psutil
38
-
39
- # ---- HF ONLY exposes this port ----
40
- EXPOSE 7860
41
-
42
- # ---- RUN app.py (THIS IS THE FIX) ----
43
- CMD ["python", "app.py"]
 
1
+ # Use a pre-built Python image
2
  FROM python:3.10-slim
3
 
4
+ # Install system dependencies
 
 
 
 
5
  RUN apt-get update && apt-get install -y \
6
+ gcc \
7
+ python3-dev \
 
8
  && rm -rf /var/lib/apt/lists/*
9
 
10
+ # Install the PRE-BUILT engine (No spinning wheel!)
11
+ RUN pip install --no-cache-dir \
12
+ flask \
13
+ requests \
14
+ llama-cpp-python --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu
15
 
16
+ # Set up the working directory
17
+ WORKDIR /app
18
  COPY . .
19
 
20
+ # Run your app
21
+ CMD ["python", "app.py"]