my-cpu-llm-api / Dockerfile
mail0000009's picture
Create Dockerfile
0c6428a verified
raw
history blame contribute delete
787 Bytes
FROM python:3.10-slim
# Install build tools
RUN apt-get update && apt-get install -y build-essential python3-dev && rm -rf /var/lib/apt/lists/*
# Setup user
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
WORKDIR $HOME/app
# Install requirements
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Create model folder
RUN mkdir -p $HOME/app/models
# Expose HF port
EXPOSE 7860
# This command runs Llama 3.2 1B (Fast on CPU)
# and sets an API Key for security
CMD ["python3", "-m", "llama_cpp.server", \
"--model", "hf://bartowski/Llama-3.2-1B-Instruct-GGUF/Llama-3.2-1B-Instruct-Q4_K_M.gguf", \
"--host", "0.0.0.0", \
"--port", "7860", \
"--api_key", "my_secret_agent_key"]