File size: 861 Bytes
63d4e3a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6f33436
 
63d4e3a
6f33436
 
 
 
63d4e3a
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# syntax=docker/dockerfile:1

FROM python:3.11-slim-bookworm

ENV PYTHONDONTWRITEBYTECODE=1 \
    PYTHONUNBUFFERED=1 \
    HF_HOME=/home/user/.cache/huggingface

# Spaces run the container as uid 1000; give it a writable home for the
# model cache.
RUN apt-get update && apt-get install -y --no-install-recommends \
    libgomp1 \
    && rm -rf /var/lib/apt/lists/* \
    && useradd -m -u 1000 user

WORKDIR /app

# llama-cpp-python comes from the project's prebuilt CPU wheel index, so
# nothing is compiled here (no llama.cpp checkout, no llama-server).
COPY requirements.txt .
RUN pip install --no-cache-dir \
    --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu \
    --only-binary llama-cpp-python \
    -r requirements.txt

COPY app ./app

USER user

EXPOSE 7860

CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]