Spaces:
Build error
Build error
Docker file for model up
Browse files- Dockerfile +34 -0
Dockerfile
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use a standard Python 3.12 image
|
| 2 |
+
FROM python:3.12-slim
|
| 3 |
+
|
| 4 |
+
WORKDIR /app
|
| 5 |
+
|
| 6 |
+
# Install all dependencies
|
| 7 |
+
RUN pip install "llama-cpp-python[server]" huggingface_hub
|
| 8 |
+
|
| 9 |
+
# --- Model Download ---
|
| 10 |
+
# Copy the download script into the container
|
| 11 |
+
COPY download_model.py .
|
| 12 |
+
|
| 13 |
+
# Make the HF_TOKEN secret available as an argument
|
| 14 |
+
# This will be passed in by the HF Spaces platform
|
| 15 |
+
ARG HF_TOKEN
|
| 16 |
+
# Run the script to download the model
|
| 17 |
+
RUN --mount=type=secret,id=HF_TOKEN \
|
| 18 |
+
python download_model.py
|
| 19 |
+
|
| 20 |
+
# --- Server Runtime ---
|
| 21 |
+
# Expose port 8000 (which we defined in README.md)
|
| 22 |
+
EXPOSE 8000
|
| 23 |
+
|
| 24 |
+
# This is the command that will run when the container starts
|
| 25 |
+
# It reads the API_KEY secret from the environment
|
| 26 |
+
CMD [ \
|
| 27 |
+
"python", \
|
| 28 |
+
"-m", "llama_cpp.server", \
|
| 29 |
+
"--model", "prem-1B-SQL.Q8_0.gguf", \
|
| 30 |
+
"--n_gpu_layers", "0", \
|
| 31 |
+
"--port", "8000", \
|
| 32 |
+
"--host", "0.0.0.0", \
|
| 33 |
+
"--api_key_env_var", "API_KEY" \
|
| 34 |
+
]
|