llama-cpp-server / Dockerfile
matthoffner's picture
Update Dockerfile
2ae36bd verified
raw
history blame
1.31 kB
FROM ${BASE_CUDA_DEV_CONTAINER} as build
# Unless otherwise specified, we make a fat build.
ARG CUDA_DOCKER_ARCH=all
RUN apt-get update && \
apt-get install -y build-essential git
# Install Python3 and pip
RUN apt-get install -y python3 python3-pip
WORKDIR /app
COPY . .
# Set nvcc architecture
ENV CUDA_DOCKER_ARCH=${CUDA_DOCKER_ARCH}
# Enable cuBLAS
ENV LLAMA_CUBLAS=1
FROM ${BASE_CUDA_RUN_CONTAINER} as runtime
# Install build and runtime dependencies
RUN apt-get update && \
apt-get install -y \
libopenblas-dev \
ninja-build \
build-essential \
pkg-config \
curl
# Install Python3 and pip for the runtime container as well
RUN apt-get install -y python3 python3-pip
RUN pip3 install -U pip setuptools wheel && \
pip3 install --verbose llama-cpp-python[server]
# Download model
RUN mkdir model && \
curl -L https://huggingface.co/matthoffner/Magicoder-S-DS-6.7B-GGUF/resolve/main/Magicoder-S-DS-6.7B_Q4_K_M.gguf -o model/gguf-model.gguf
COPY ./start_server.sh ./
COPY ./main.py ./
COPY ./index.html ./
# Make the server start script executable
RUN chmod +x ./start_server.sh
# Set environment variable for the host
ENV HOST=0.0.0.0
ENV PORT=7860
# Expose a port for the server
EXPOSE ${PORT}
# Run the server start script
CMD ["/bin/sh", "./start_server.sh"]