File size: 1,352 Bytes
e59dc66
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
48
FROM nvidia/cuda:12.1.1-cudnn8-devel-ubuntu22.04

# Set environment variables
ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONUNBUFFERED=1
ENV HF_HOME=/root/.cache/huggingface
ENV TRANSFORMERS_CACHE=/root/.cache/huggingface/transformers
ENV MPLCONFIGDIR=/tmp/matplotlib

# Create necessary directories with proper permissions
RUN mkdir -p /root/.cache/huggingface/transformers && \
    mkdir -p /tmp/matplotlib && \
    chmod -R 777 /root/.cache && \
    chmod -R 777 /tmp/matplotlib

# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
    build-essential \
    git \
    curl \
    ca-certificates \
    python3-pip \
    python3-dev \
    python3-setuptools \
    && rm -rf /var/lib/apt/lists/*

# Create a working directory
WORKDIR /app

# Copy requirements file and install Python dependencies
COPY requirements.txt .

RUN pip3 install --no-cache-dir --upgrade pip && \
    pip3 install --no-cache-dir -r requirements.txt && \
    # Install additional dependencies for lmdeploy
    pip3 install --no-cache-dir cmake && \
    pip3 install --no-cache-dir ninja && \
    # Install flash-attention for performance
    pip3 install --no-cache-dir flash-attn

# Copy the application files
COPY . .

# Make port 7860 available for the app
EXPOSE 7860

# Start the application
CMD ["python3", "app_internvl2.py"]