prem-sql-api / Dockerfile
PreethiCarmelBosco's picture
Docker file for model up
edbabe5 verified
raw
history blame
897 Bytes
# Use a standard Python 3.12 image
FROM python:3.12-slim
WORKDIR /app
# Install all dependencies
RUN pip install "llama-cpp-python[server]" huggingface_hub
# --- Model Download ---
# Copy the download script into the container
COPY download_model.py .
# Make the HF_TOKEN secret available as an argument
# This will be passed in by the HF Spaces platform
ARG HF_TOKEN
# Run the script to download the model
RUN --mount=type=secret,id=HF_TOKEN \
python download_model.py
# --- Server Runtime ---
# Expose port 8000 (which we defined in README.md)
EXPOSE 8000
# This is the command that will run when the container starts
# It reads the API_KEY secret from the environment
CMD [ \
"python", \
"-m", "llama_cpp.server", \
"--model", "prem-1B-SQL.Q8_0.gguf", \
"--n_gpu_layers", "0", \
"--port", "8000", \
"--host", "0.0.0.0", \
"--api_key_env_var", "API_KEY" \
]