Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +8 -14
Dockerfile
CHANGED
|
@@ -1,25 +1,19 @@
|
|
| 1 |
-
|
|
|
|
| 2 |
|
| 3 |
-
#
|
| 4 |
RUN apt-get update && apt-get install -y \
|
| 5 |
-
|
| 6 |
-
cmake \
|
| 7 |
-
python3-dev \
|
| 8 |
&& rm -rf /var/lib/apt/lists/*
|
| 9 |
|
| 10 |
WORKDIR /code
|
| 11 |
|
| 12 |
-
#
|
| 13 |
COPY ./requirements.txt /code/requirements.txt
|
| 14 |
-
RUN pip install --no-cache-dir -
|
| 15 |
-
|
| 16 |
-
# 3. Build llama-cpp-python with specific CPU settings
|
| 17 |
-
# This ensures it doesn't look for a GPU (which the free tier doesn't have)
|
| 18 |
-
RUN CMAKE_ARGS="-DLLAMA_BLAS=ON -DLLAMA_BLAS_VENDOR=OpenBLAS" \
|
| 19 |
-
FORCE_CMAKE=1 \
|
| 20 |
-
pip install llama-cpp-python --no-cache-dir
|
| 21 |
|
|
|
|
| 22 |
COPY . .
|
| 23 |
|
| 24 |
-
#
|
| 25 |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 1 |
+
# Use Python 3.10 to match our pre-built engine
|
| 2 |
+
FROM python:3.10-slim
|
| 3 |
|
| 4 |
+
# Install only the light-weight math library needed for inference
|
| 5 |
RUN apt-get update && apt-get install -y \
|
| 6 |
+
libopenblas-dev \
|
|
|
|
|
|
|
| 7 |
&& rm -rf /var/lib/apt/lists/*
|
| 8 |
|
| 9 |
WORKDIR /code
|
| 10 |
|
| 11 |
+
# Install our requirements (this is now very fast)
|
| 12 |
COPY ./requirements.txt /code/requirements.txt
|
| 13 |
+
RUN pip install --no-cache-dir -r /code/requirements.txt
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
+
# Copy your Python logic
|
| 16 |
COPY . .
|
| 17 |
|
| 18 |
+
# Start the API on port 7860
|
| 19 |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|