File size: 1,231 Bytes
ee86994
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3c70d1e
ee86994
 
 
 
 
 
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-runtime-ubuntu22.04

# System dependencies (as root)
RUN apt-get update && apt-get install -y \
    git \
    curl \
    wget \
    python3 \
    python3-pip \
    python3-dev \
    libgl1 \
    && rm -rf /var/lib/apt/lists/*

# Set Python aliases (as root)
RUN ln -s /usr/bin/python3 /usr/bin/python
RUN ln -sf /usr/bin/pip3 /usr/bin/pip

# Install system-level Python packages (as root)
RUN pip install --upgrade pip

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

# Install Python packages as user (goes to ~/.local/bin)
RUN pip install --no-cache-dir --user "vllm[triton]"
RUN pip install --no-cache-dir --user gradio Pillow requests aiohttp

# Copy files with correct ownership
COPY --chown=user numarkdown.svg $HOME/app/
COPY --chown=user app.py $HOME/app/
COPY --chown=user start.sh $HOME/app/
COPY --chown=user example_images/ $HOME/app/example_images/
RUN chmod +x $HOME/app/start.sh

# Expose the Space UI port
EXPOSE 7860

CMD ["./start.sh"]