Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +21 -13
Dockerfile
CHANGED
|
@@ -1,25 +1,33 @@
|
|
| 1 |
-
|
|
|
|
| 2 |
|
|
|
|
| 3 |
RUN apt-get update && apt-get install -y \
|
| 4 |
-
git \
|
| 5 |
build-essential \
|
| 6 |
-
cmake
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
|
| 13 |
-
#
|
| 14 |
-
|
| 15 |
-
RUN cmake -B build
|
| 16 |
-
RUN cmake --build build --config Release
|
| 17 |
|
|
|
|
| 18 |
WORKDIR /app
|
| 19 |
|
|
|
|
| 20 |
COPY requirements.txt .
|
| 21 |
-
RUN pip install -r requirements.txt
|
| 22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
COPY . .
|
| 24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
CMD ["uvicorn", "server:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 1 |
+
# Use a slim Python base
|
| 2 |
+
FROM python:3.11-slim
|
| 3 |
|
| 4 |
+
# Install system dependencies (build tools, cmake for llama.cpp, nodejs for promptfoo)
|
| 5 |
RUN apt-get update && apt-get install -y \
|
|
|
|
| 6 |
build-essential \
|
| 7 |
+
cmake \
|
| 8 |
+
git \
|
| 9 |
+
curl \
|
| 10 |
+
nodejs \
|
| 11 |
+
npm \
|
| 12 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 13 |
|
| 14 |
+
# Install promptfoo globally (our security testing tool)
|
| 15 |
+
RUN npm install -g promptfoo
|
|
|
|
|
|
|
| 16 |
|
| 17 |
+
# Set working directory
|
| 18 |
WORKDIR /app
|
| 19 |
|
| 20 |
+
# Copy Python requirements first (better caching)
|
| 21 |
COPY requirements.txt .
|
|
|
|
| 22 |
|
| 23 |
+
# Install Python dependencies
|
| 24 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 25 |
+
|
| 26 |
+
# Copy the rest of the application
|
| 27 |
COPY . .
|
| 28 |
|
| 29 |
+
# Expose the port Hugging Face uses
|
| 30 |
+
EXPOSE 7860
|
| 31 |
+
|
| 32 |
+
# Run the server
|
| 33 |
CMD ["uvicorn", "server:app", "--host", "0.0.0.0", "--port", "7860"]
|