ProfessorCEO commited on
Commit
fafb685
·
verified ·
1 Parent(s): 6577d50

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +7 -8
Dockerfile CHANGED
@@ -1,6 +1,6 @@
1
  FROM python:3.10-slim
2
 
3
- # Set up user to avoid permission issues (Required by HF Spaces)
4
  RUN useradd -m -u 1000 user
5
  USER user
6
  ENV HOME=/home/user \
@@ -8,22 +8,21 @@ ENV HOME=/home/user \
8
 
9
  WORKDIR $HOME/app
10
 
11
- # Install system compilers
12
  USER root
13
  RUN apt-get update && apt-get install -y \
14
- build-essential \
15
- cmake \
16
  git \
17
  && rm -rf /var/lib/apt/lists/*
18
  USER user
19
 
20
- # Install Python packages
 
21
  COPY --chown=user requirements.txt requirements.txt
22
  RUN pip install --no-cache-dir --upgrade pip && \
23
- pip install --no-cache-dir -r requirements.txt
24
 
25
- # Copy the app code
26
  COPY --chown=user . .
27
 
28
- # Start the server on port 7860 (Required by HF Spaces)
29
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
  FROM python:3.10-slim
2
 
3
+ # 1. Setup User (Required for Spaces)
4
  RUN useradd -m -u 1000 user
5
  USER user
6
  ENV HOME=/home/user \
 
8
 
9
  WORKDIR $HOME/app
10
 
11
+ # 2. Install Basic Tools (Keep these just in case)
12
  USER root
13
  RUN apt-get update && apt-get install -y \
 
 
14
  git \
15
  && rm -rf /var/lib/apt/lists/*
16
  USER user
17
 
18
+ # 3. SMART INSTALL: Use Pre-Built Wheels!
19
+ # We copy requirements but use a special URL to fetch the pre-compiled engine
20
  COPY --chown=user requirements.txt requirements.txt
21
  RUN pip install --no-cache-dir --upgrade pip && \
22
+ pip install --no-cache-dir -r requirements.txt --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu
23
 
24
+ # 4. Copy Application
25
  COPY --chown=user . .
26
 
27
+ # 5. Launch
28
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]