Spaces:
Runtime error
Runtime error
add dockerfile
Browse files- Dockerfile +33 -0
Dockerfile
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# 1. Start from HF’s official CPU base image
|
| 2 |
+
FROM ghcr.io/huggingface/spaces-cpu:latest
|
| 3 |
+
|
| 4 |
+
# 2. Install OpenBLAS and build tools
|
| 5 |
+
RUN apt-get update && \
|
| 6 |
+
apt-get install -y --no-install-recommends \
|
| 7 |
+
build-essential cmake libopenblas-dev python3-opencv && \
|
| 8 |
+
rm -rf /var/lib/apt/lists/*
|
| 9 |
+
|
| 10 |
+
# 3. Set CMake flags so llama-cpp-python picks up OpenBLAS
|
| 11 |
+
ENV CMAKE_ARGS="-DGGML_BLAS=ON -DGGML_BLAS_VENDOR=OpenBLAS"
|
| 12 |
+
|
| 13 |
+
# 4. Copy your code into /app and install Python deps
|
| 14 |
+
WORKDIR /app
|
| 15 |
+
COPY requirements.txt packages.txt postBuild ./
|
| 16 |
+
COPY app.py ./
|
| 17 |
+
# (Copy any other files or directories your app needs)
|
| 18 |
+
|
| 19 |
+
# 5. Install Python dependencies
|
| 20 |
+
# - APT deps from packages.txt
|
| 21 |
+
RUN xargs -r apt-get update -qq && \
|
| 22 |
+
xargs -r -a packages.txt apt-get install -y && \
|
| 23 |
+
rm -rf /var/lib/apt/lists/*
|
| 24 |
+
|
| 25 |
+
# - Python deps (excluding llama-cpp-python)
|
| 26 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 27 |
+
|
| 28 |
+
# 6. Build and install llama-cpp-python from source
|
| 29 |
+
RUN pip install --no-cache-dir --force-reinstall --no-binary llama-cpp-python llama-cpp-python
|
| 30 |
+
|
| 31 |
+
# 7. Expose and launch your app
|
| 32 |
+
EXPOSE 7860
|
| 33 |
+
CMD ["python", "app.py"]
|