PMBeta / Dockerfile
Sergidev's picture
Update Dockerfile
12da5b1 verified
raw
history blame
1.15 kB
# Use the NVIDIA CUDA image as the base
FROM nvidia/cuda:12.1.1-cudnn8-runtime-ubuntu20.04
# Set non-interactive mode for apt-get
ENV DEBIAN_FRONTEND=noninteractive
# Install system dependencies
RUN apt-get update && apt-get install -y \
python3 \
python3-pip \
cmake \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Set up a new user named "user" with user ID 1000
RUN useradd -m -u 1000 user
# Set the working directory
WORKDIR /app
# Copy the requirements file
COPY requirements.txt .
# Install Python dependencies
RUN pip3 install --no-cache-dir --upgrade pip && \
pip3 install --no-cache-dir -r requirements.txt
# Install llama-cpp-python with CUDA support
ENV FORCE_CMAKE=1
ENV CMAKE_ARGS="-DLLAMA_CUBLAS=on"
RUN pip3 install --no-cache-dir llama-cpp-python
# Copy the rest of the application code
COPY . .
# Change ownership of the app directory to the user
RUN chown -R user:user /app
# Switch to the "user" user
USER user
# Set the PATH to include the user's local bin directory
ENV PATH="/home/user/.local/bin:$PATH"
# Run the application
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]