File size: 1,042 Bytes
08d6535
 
1a8807d
08d6535
1a8807d
08d6535
 
1a8807d
 
08d6535
 
 
 
 
1a8807d
 
08d6535
 
 
 
 
 
 
 
 
 
 
 
1a8807d
 
 
08d6535
1a8807d
08d6535
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# Use the NVIDIA CUDA image as the base
FROM nvidia/cuda:12.1.1-cudnn8-runtime-ubuntu20.04

# 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 /app

# Install Python and pip
RUN apt-get update && apt-get install -y python3 python3-pip

# Install CMake and other build dependencies
RUN apt-get install -y cmake build-essential

# Install llama-cpp-python with CUDA support
ENV FORCE_CMAKE=1
ENV CMAKE_ARGS="-DLLAMA_CUBLAS=on"
RUN pip install llama-cpp-python --no-cache-dir

# Copy the current directory contents into the container at /app
COPY --chown=user ./requirements.txt requirements.txt
RUN pip install --no-cache-dir --upgrade -r requirements.txt

# Copy the rest of the application code
COPY --chown=user . /app

# Run the application
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]