File size: 1,808 Bytes
517e32b
 
1496118
7da60bc
 
9906713
f9247a2
9906713
1496118
 
 
 
 
 
 
 
 
7da60bc
1496118
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1fcde4a
3c440d3
1496118
 
 
 
 
 
 
 
 
 
 
 
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
49
50
51
52
53
54
55
56
57
58
# Use an official PyTorch image with CUDA support as the base image
FROM pytorch/pytorch:2.0.1-cuda11.7-cudnn8-runtime

RUN apt-get update && apt-get install -y build-essential

# Install a specific version of pip (e.g., 20.2.4)
RUN pip install --upgrade pip

# Install Git and system libraries required for OpenGL without interactive prompts
ENV DEBIAN_FRONTEND=noninteractive

# Install Git, OpenGL libraries, and libglib2.0
RUN apt-get update && apt-get install -y git libgl1-mesa-glx libglib2.0-0

# Set the pip resolver to "legacy"
RUN pip config set global.resolver legacy

#RUN apt-get update && apt-get install -y ninja-build

# 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 environment variables
ENV HOME=/home/user \
    CUDA_HOME=/usr/local/cuda \
    PATH=/home/user/.local/bin:$PATH \
    LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH} \
    LIBRARY_PATH=${CUDA_HOME}/lib64/stubs:${LIBRARY_PATH} \
    PYTHONPATH=$HOME/app \
    PYTHONUNBUFFERED=1 \
    GRADIO_ALLOW_FLAGGING=never \
    GRADIO_NUM_PORTS=1 \
    GRADIO_SERVER_NAME=0.0.0.0 \
    GRADIO_THEME=huggingface \
    GRADIO_SHARE=False \
    SYSTEM=spaces

# Set the working directory to the user's home directory
WORKDIR $HOME/app

COPY . .

# Install dependencies
# Use the new pip resolver and always take the latest version if not specified
RUN pip install --use-feature=fast-deps -r requirements.txt gradio


# Update package lists and install other dependencies as needed
# Ensure that CUDA components are correctly installed and configured
# Install any other required packages

# Set the environment variable to specify the GPU device
ENV CUDA_DEVICE_ORDER=PCI_BUS_ID
ENV CUDA_VISIBLE_DEVICES=0

# Run your app.py script
CMD ["python", "app.py"]