Skip to content

Commit

Permalink
Update cuda.Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
Smartappli authored Jul 27, 2024
1 parent 31c3d33 commit 91e98a2
Showing 1 changed file with 5 additions and 20 deletions.
25 changes: 5 additions & 20 deletions Docker/cuda/cuda.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,26 @@ ARG CUDA_IMAGE="12.5.0-devel-ubuntu22.04"
FROM nvidia/cuda:${CUDA_IMAGE}

# We need to set the host to 0.0.0.0 to allow outside access
ENV HOST=0.0.0.0
ENV PORT=8008
ENV HOST 0.0.0.0

# Install necessary packages
RUN apt-get update && apt-get upgrade -y \
&& apt-get install -y git build-essential \
python3 python3-pip gcc wget \
ocl-icd-opencl-dev opencl-headers clinfo \
libclblast-dev libopenblas-dev \
&& mkdir -p /etc/OpenCL/vendors && echo "libnvidia-opencl.so.1" > /etc/OpenCL/vendors/nvidia.icd

# Copy the application code
COPY --chown=root:root --chmod=755 . .
COPY . .

# Create a non-root user
RUN useradd -m myuser

# Change to the non-root user
USER myuser

# Add .local/bin to PATH
ENV PATH="/home/myuser/.local/bin:${PATH}"

# Set build-related environment variables
# setting build related env vars
ENV CUDA_DOCKER_ARCH=all
ENV LLAMA_CUBLAS=1

# Install dependencies
# Install depencencies
RUN python3 -m pip install --upgrade pip pytest cmake scikit-build setuptools fastapi uvicorn sse-starlette pydantic-settings starlette-context

# Install llama-cpp-python (build with CUDA)
# Install llama-cpp-python (build with cuda)
RUN CMAKE_ARGS="-DLLAMA_CUBLAS=on" pip install llama-cpp-python

# Expose the port
EXPOSE 8008

# Run the server
CMD ["python3", "-m", "llama_cpp.server", "--config_file", "config-cuda.json"]

0 comments on commit 91e98a2

Please sign in to comment.