SmolVLM2-on-llama.cpp / Dockerfile
Luigi's picture
merge packages.txt content into dockerfile then make it also use reuirements.txt
35aa7f2
raw
history blame
1.31 kB
# 1. Base image
FROM python:3.10-slim
# 2. Noninteractive + timezone
ENV DEBIAN_FRONTEND=noninteractive \
TZ=Etc/UTC \
XDG_CACHE_HOME=/tmp/.cache \
HF_HOME=/tmp/.cache/huggingface
# 3. Use bash strict mode
SHELL ["/bin/bash", "-euxo", "pipefail", "-c"]
# 4. Install system deps and set timezone
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
tzdata \
git \
pkg-config \
cmake \
build-essential \
python3-opencv \
build-essential \
cmake \
libopenblas-dev \
libopenblas-dev \
&& ln -sf /usr/share/zoneinfo/$TZ /etc/localtime \
&& echo $TZ > /etc/timezone \
&& rm -rf /var/lib/apt/lists/*
# 5. Prepare cache dirs
RUN mkdir -p "$XDG_CACHE_HOME" "$HF_HOME" \
&& chmod -R a+rwX "$XDG_CACHE_HOME" "$HF_HOME"
# 6. Build llama-cpp-python with OpenBLAS
RUN git clone --depth 1 --recurse-submodules \
https://github.com/abetlen/llama-cpp-python.git /tmp/llama-cpp-python \
&& cd /tmp/llama-cpp-python \
&& CMAKE_ARGS="-DGGML_BLAS=ON -DGGML_BLAS_VENDOR=OpenBLAS" pip install . \
&& rm -rf /tmp/llama-cpp-python
# 7. (Optional) Your other Python deps
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# 8. Copy app code
COPY . .
# 9. Expose & run
EXPOSE 7860
CMD ["python3", "app.py"]