File size: 1,217 Bytes
08d6535
 
1a8807d
12da5b1
 
 
0577dcd
 
 
 
 
 
 
 
08d6535
1a8807d
08d6535
0577dcd
1a8807d
 
0577dcd
 
08d6535
0577dcd
 
 
08d6535
 
94530e2
 
 
 
1a8807d
08d6535
0577dcd
 
 
 
 
 
 
08d6535
12da5b1
 
 
08d6535
0577dcd
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
38
39
40
41
42
43
44
45
46
47
# 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 llama-cpp-python \
  --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cu121

# 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"]