fugthchat commited on
Commit
2de07d9
·
1 Parent(s): 1bde1ff

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +20 -25
Dockerfile CHANGED
@@ -1,32 +1,27 @@
1
- # Use lightweight Python
2
- FROM python:3.9-slim
3
 
4
- # Set working directory
5
- WORKDIR /code
 
 
6
 
7
- # 1. FIX: Install System Build Tools (Required for llama-cpp-python)
8
- RUN apt-get update && apt-get install -y \
9
- build-essential \
10
- cmake \
11
- gcc \
12
- && rm -rf /var/lib/apt/lists/*
13
 
14
- # Copy requirements
15
- COPY ./requirements.txt /code/requirements.txt
 
 
16
 
17
- # 2. Install the easy packages
18
- RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
 
 
19
 
20
- # 3. Install AI Engine (Now supports compiling if needed)
21
- RUN pip install llama-cpp-python \
22
- --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu
23
 
24
- # Copy the rest of the app
25
- COPY . .
26
 
27
- # Permissions for Hugging Face
28
- RUN mkdir -p /code/.cache && chmod -R 777 /code/.cache
29
- ENV TRANSFORMERS_CACHE=/code/.cache
30
-
31
- # Start App
32
- CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
+ FROM python:3.10-slim
 
2
 
3
+ ENV PYTHONDONTWRITEBYTECODE=1 \
4
+ PYTHONUNBUFFERED=1 \
5
+ PIP_NO_CACHE_DIR=1 \
6
+ PORT=7860
7
 
8
+ WORKDIR /app
 
 
 
 
 
9
 
10
+ # Runtime deps (libgomp helps llama-cpp wheels / OpenMP)
11
+ RUN apt-get update \
12
+ ; apt-get install -y --no-install-recommends libgomp1 ca-certificates \
13
+ ; rm -rf /var/lib/apt/lists/*
14
 
15
+ # Install deps first (better layer caching)
16
+ COPY requirements.txt ./
17
+ RUN pip install --upgrade pip \
18
+ ; pip install -r requirements.txt
19
 
20
+ # Copy app and model files
21
+ COPY app.py ./
22
+ COPY *.gguf ./
23
 
24
+ EXPOSE 7860
 
25
 
26
+ # HuggingFace expects the app to listen on 0.0.0.0:7860
27
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--proxy-headers", "--forwarded-allow-ips", "*"]