Spaces:
Sleeping
Sleeping
Create DOCKERFILE
Browse files- DOCKERFILE +33 -0
DOCKERFILE
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Base image with Python and llama-cpp dependencies
|
2 |
+
FROM python:3.11-slim
|
3 |
+
|
4 |
+
# System dependencies for llama-cpp
|
5 |
+
RUN apt-get update && apt-get install -y \
|
6 |
+
build-essential \
|
7 |
+
cmake \
|
8 |
+
wget \
|
9 |
+
git \
|
10 |
+
&& rm -rf /var/lib/apt/lists/*
|
11 |
+
|
12 |
+
# Install Python packages
|
13 |
+
RUN pip install --no-cache-dir \
|
14 |
+
llama-cpp-python==0.2.66 \
|
15 |
+
fastapi \
|
16 |
+
uvicorn \
|
17 |
+
huggingface-hub
|
18 |
+
|
19 |
+
# Create app directory
|
20 |
+
WORKDIR /app
|
21 |
+
COPY . /app
|
22 |
+
|
23 |
+
# Download model from Hugging Face Hub (on container startup)
|
24 |
+
ENV MODEL_REPO=TheBloke/phi-2-GGUF
|
25 |
+
ENV MODEL_FILE=phi-2.Q4_K_M.gguf
|
26 |
+
|
27 |
+
# Create model loader script
|
28 |
+
RUN echo '#!/bin/bash\n'\
|
29 |
+
'python download_model.py\n'\
|
30 |
+
'uvicorn main:app --host 0.0.0.0 --port 7860' > entrypoint.sh && \
|
31 |
+
chmod +x entrypoint.sh
|
32 |
+
|
33 |
+
CMD ["./entrypoint.sh"]
|