fallback_module_trial / Dockerfile
fomext's picture
Update Dockerfile
d3cc4db verified
Raw
History Blame
2.24 kB
# ============================================================
# Qwen3-14B – OpenAI-compatible API – CPU-only Docker image
# ============================================================
FROM python:3.11-slim
# Build-time deps for llama-cpp-python (needs a C++ compiler)
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
cmake \
git \
wget \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# ── Python deps ──────────────────────────────────────────────
# Install everything EXCEPT llama-cpp-python first (lighter layer)
COPY requirements.txt .
RUN pip install --no-cache-dir fastapi==0.111.0 uvicorn[standard]==0.29.0 pydantic==2.7.1
# Install llama-cpp-python with CPU-only build (no CUDA/Metal/OpenCL)
# CMAKE_ARGS forces a plain CPU build; FORCE_CMAKE=1 ensures the wheel
# is compiled from source so the flags are respected.
RUN CMAKE_ARGS="-DLLAMA_CUBLAS=OFF -DLLAMA_METAL=OFF -DLLAMA_OPENCL=OFF" \
FORCE_CMAKE=1 \
pip install --no-cache-dir llama-cpp-python==0.2.77
# ── App code ─────────────────────────────────────────────────
COPY app.py .
# ── Model volume ─────────────────────────────────────────────
# Mount your GGUF file here at runtime:
# docker run -v /path/to/models:/models ...
# OR bake it into the image by uncommenting the COPY line below
# (image will be ~9 GB for Q4_K_M):
# COPY models/qwen3-14b-q4_k_m.gguf /models/qwen3-14b-q4_k_m.gguf
RUN mkdir -p /models
# ── Runtime env defaults (override with -e flags) ────────────
ENV MODEL_PATH=/models/qwen3-14b-q4_k_m.gguf \
MODEL_ID=qwen3-14b \
N_CTX=4096 \
N_THREADS=8 \
N_BATCH=512 \
VERBOSE=false
EXPOSE 8000
HEALTHCHECK --interval=30s --timeout=10s --start-period=120s --retries=3 \
CMD wget -qO- http://localhost:8000/health || exit 1
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]