RAGchat / Dockerfile
moriire's picture
Update Dockerfile
9471754 verified
raw
history blame
2.22 kB
# Define the image argument and provide a default value
#ARG IMAGE=python:3-slim-bullseye
# Use the image as specified
#FROM ${IMAGE}
# Re-declare the ARG after FROM
#ARG IMAGE
# Update and upgrade the existing packages
#RUN apt-get update && apt-get upgrade -y && apt-get install -y --no-install-recommends \
# python3 \
# python3-pip \
# ninja-build \
# libopenblas-dev \
# build-essential
#RUN mkdir /app
#WORKDIR /app
#COPY . .
#RUN python3 -m pip install --upgrade pip
#RUN make deps && make build && make clean
# Set environment variable for the host
#ENV HOST=0.0.0.0
#ENV PORT=7860
#ENV ORIGINS=*
# Install requirements.txt
#RUN pip install --no-cache-dir --upgrade -r requirements.txt
# Set up a new user named "user" with user ID 1000
#RUN useradd -m -u 1000 user
# Switch to the "user" user
#USER user
# Set home to the user's home directory
#ENV HOME=/home/user \
# PATH=/home/user/.local/bin:$PATH
# Set the working directory to the user's home directory
# WORKDIR $HOME/app
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
#COPY --chown=user . $HOME
# Start the FastAPI app on port 7860, the default port expected by Spaces
#CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
#ENTRYPOINT ["python3"]
#ENTRYPOINT ["python3", "-m", "llama_cpp.server", "--hf_model_repo_id", "Qwen/Qwen1.5-0.5B-Chat-GGUF", "--model", "*q4_0.gguf", "--host", "0.0.0.0"]
FROM python:3-slim-bullseye
# It's not at all clear why the image published by the llama-cpp-python author doesn't work,
# but it can't find the llama libraries, soI had to re-build the docker container
# We need to set the host to 0.0.0.0 to allow outside access
ENV HOST 0.0.0.0
COPY . .
# Install the package
RUN apt update && apt install -y libopenblas-dev ninja-build build-essential pkg-config
RUN python -m pip install --upgrade pip pytest cmake scikit-build setuptools fastapi uvicorn sse-starlette pydantic-settings starlette-context
RUN CMAKE_ARGS="-DLLAMA_BLAS=ON -DLLAMA_BLAS_VENDOR=OpenBLAS" pip install llama_cpp_python --verbose
# Run the server
CMD python3 -m llama_cpp.server --model $MODEL --n_gpu_layers $N_GPU_LAYERS --n_batch $N_BATCH