llama-cpp-api / Dockerfile
imperialwool's picture
Update Dockerfile
03d499e verified
# Loading base. I'm using Alpine, u can use whatever u want.
FROM python:3.11.9-alpine3.20
# Just for sure everything will be fine.
# ALSO ITS BAD! But since its docker, probably.. screw it?
USER root
# Installing gcc compiler and main library.
RUN apk update && apk add wget build-base python3-dev musl-dev linux-headers
RUN CMAKE_ARGS="-DLLAMA_BLAS=ON -DLLAMA_BLAS_VENDOR=OpenBLAS" pip install llama-cpp-python
# Copying files into folder and making it working dir.
RUN mkdir app
COPY . /app
RUN chmod -R 777 /app
WORKDIR /app
# Making dir for translator model (facebook/m2m100_1.2B)
RUN mkdir translator
RUN chmod -R 777 translator
# Installing wget and downloading model.
ADD https://huggingface.co/Vikhrmodels/Vikhr-Qwen-2.5-1.5B-Instruct-GGUF/resolve/main/Vikhr-Qwen-2.5-1.5b-Instruct-Q4_1.gguf /app/model.bin
RUN chmod -R 777 /app/model.bin
# You can use other models! Or u can comment this two RUNs and include in Space/repo/Docker image own model with name "model.bin".
# Fixing warnings from Transformers and Matplotlib
RUN mkdir -p /.cache/huggingface/hub -m 777
RUN mkdir -p /.config/matplotlib -m 777
RUN chmod -R 777 /.cache
RUN chmod -R 777 /.config
# Updating pip and installing everything from requirements
RUN python3 -m pip install -U pip setuptools wheel
RUN pip install --upgrade -r /app/requirements.txt
# Now it's time to run Gradio app!
CMD ["python", "gradio_app.py"]