FROM nvidia/cuda:10.1-cudnn7-runtime # Set the working directory WORKDIR $HOME/app # Copy the requirements file COPY requirements.txt . RUN apt-get update && \ apt-get install -y --no-install-recommends \ build-essential \ python3-dev \ python3-pip \ libglib2.0-0 && \ rm -rf /var/lib/apt/lists/* RUN CMAKE_ARGS="-DLLAMA_CUBLAS=on" FORCE_CMAKE=1 pip install llama-cpp-python --no-cache-dir RUN pip install --upgrade pip && \ pip install --no-cache-dir --upgrade -r requirements.txt # Copy the installed packages to a new image FROM nvidia/cuda:10.1-cudnn7-runtime COPY --from=0 /root/.local /root/.local ENV PATH=/root/.local/bin:$PATH EXPOSE 7860 RUN useradd -m -u 1000 user USER user # Set the working directory and copy the application code WORKDIR /app COPY --chown=user . $HOME/app RUN ls -al CMD ["python", "app.py", "--host", "127.0.0.1", "--port", "7860"]