File size: 5,202 Bytes
3bb958e
 
 
f66aca9
 
7c88136
3bb958e
 
 
 
 
 
 
7c88136
 
3bb958e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f66aca9
7c88136
 
 
 
 
 
49bee30
3bb958e
 
 
 
 
 
 
f66aca9
 
 
 
 
3bb958e
 
 
 
f66aca9
3bb958e
f66aca9
3bb958e
f66aca9
 
 
 
 
 
3bb958e
f66aca9
 
 
 
 
 
3bb958e
 
 
 
 
 
f66aca9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# FROM nvidia/cuda:12.1.1-cudnn8-devel-ubuntu22.04

# ARG DEBIAN_FRONTEND=noninteractive


# RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
#     curl git wget libgl1 freeglut3-dev unzip ffmpeg libsm6 libxext6 libgomp1 \
#     libfontconfig1 libegl1-mesa-dev libgl1-mesa-glx libglapi-mesa libc6 \
#     libxdamage1 libxfixes3 libxcb-glx0 libxcb-dri2-0 libosmesa6-dev \
#     libxcb-dri3-0 libxcb-present0 libxcb-sync1 libxshmfence1 libxxf86vm1 \
#     libgl1-mesa-dev libgles2-mesa-dev libglib2.0-dev libxrender1 libgbm1 \
#     build-essential libeigen3-dev python3.10 python3-pip python-is-python3 \
#     python3-opencv nvidia-cuda-toolkit \
#     && rm -rf /var/lib/apt/lists/*

# # Set up a new user named "user" with user ID 1000
# RUN useradd -m -u 1000 user
# # libgl1
# # unzip
# # ffmpeg 
# # libsm6 
# # libxext6
# # libgl1-mesa-dri
# # libegl1-mesa
# # libgbm1
# # libosmesa6
# # python3-opengl

# # Switch to the "user" user
# USER user

# FROM python:3.10

# ENV PYTHONUNBUFFERED=1

# ENV TORCH_CUDA_ARCH_LIST="6.0 6.1 7.0 7.5 8.0 8.6"
# ENV TCNN_CUDA_ARCHITECTURES=86;80;75;70;61;60
# ENV FORCE_CUDA=1

# ENV CUDA_HOME=/usr/local/cuda
# ENV PATH=${CUDA_HOME}/bin:/home/${USER_NAME}/.local/bin:/usr/bin:${PATH}
# ENV LD_LIBRARY_PATH=${CUDA_HOME}/lib64:/usr/local/lib/python3.8/site-packages/open3d:/usr/lib:/usr/lib64:${LD_LIBRARY_PATH}
# ENV LIBRARY_PATH=${CUDA_HOME}/lib64/stubs:/usr/local/lib/python3.8/site-packages/open3d:/usr/lib:/usr/lib64:${LIBRARY_PATH}

# # Set home to the user's home directory
# ENV HOME=/home/user \
#     PATH=/home/user/.local/bin:$PATH \
#     PYTHONPATH=$HOME/app:$PYTHONPATH \
# 	PYTHONUNBUFFERED=1 \
# 	GRADIO_ALLOW_FLAGGING=never \
# 	GRADIO_NUM_PORTS=1 \
# 	GRADIO_SERVER_NAME=0.0.0.0 \
# 	GRADIO_THEME=huggingface \
# 	SYSTEM=spaces

# RUN pip install --upgrade pip setuptools ninja
# RUN pip install torch==2.3.1+cu121 -f https://download.pytorch.org/whl/cu113/torch_stable.html

# RUN python -c "import torch; print(torch.version.cuda)"
# COPY requirements.txt /tmp
# RUN cd /tmp && pip install -r requirements.txt

# # RUN pip install https://download.is.tue.mpg.de/icon/HF/kaolin-0.11.0-cp38-cp38-linux_x86_64.whl
# # RUN pip install https://download.is.tue.mpg.de/icon/HF/pytorch3d-0.7.0-cp38-cp38-linux_x86_64.whl

# RUN chmod 777 $HOME
# ENV TRANSFORMERS_CACHE=/tmp
# ENV MPLCONFIGDIR=/tmp

# # Copy the current directory contents into the container at $HOME/app setting the owner to the user
# COPY --chown=user . $HOME/app

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

# CMD ["python", "app.py"]

#----------------------------------------
FROM nvidia/cuda:12.1.1-cudnn8-devel-ubuntu22.04

ARG DEBIAN_FRONTEND=noninteractive

RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
    curl git wget libgl1 freeglut3-dev unzip ffmpeg libsm6 libxext6 libgomp1 \
    libfontconfig1 libegl1-mesa-dev libgl1-mesa-glx libglapi-mesa libc6 \
    libxdamage1 libxfixes3 libxcb-glx0 libxcb-dri2-0 libosmesa6-dev \
    libxcb-dri3-0 libxcb-present0 libxcb-sync1 libxshmfence1 libxxf86vm1 \
    libgl1-mesa-dev libgles2-mesa-dev libglib2.0-dev libxrender1 libgbm1 \
    build-essential libeigen3-dev python3.10 python3-pip python-is-python3 \
    python3-opencv \
    libegl1 \
    libegl1-mesa \
    libglvnd0 \
    libglx0 \
    libglvnd-dev \
    libglx-dev \
    libegl-dev \
    && rm -rf /var/lib/apt/lists/*

# Set up a new user named "user" with user ID 1000
RUN useradd -m -u 1000 user

# Set NVIDIA and EGL specific environment variables
ENV NVIDIA_DRIVER_CAPABILITIES=compute,utility,graphics
ENV __GLX_VENDOR_LIBRARY_NAME=nvidia
ENV NVIDIA_VISIBLE_DEVICES=all

USER user

ENV PYTHONUNBUFFERED=1
ENV TORCH_CUDA_ARCH_LIST="6.0 6.1 7.0 7.5 8.0 8.6"
ENV TCNN_CUDA_ARCHITECTURES=86;80;75;70;61;60
ENV FORCE_CUDA=1

ENV CUDA_HOME=/usr/local/cuda
ENV PATH=${CUDA_HOME}/bin:/home/${USER_NAME}/.local/bin:/usr/bin:${PATH}
ENV LD_LIBRARY_PATH=${CUDA_HOME}/lib64:/usr/local/lib/python3.8/site-packages/open3d:/usr/lib:/usr/lib64:/usr/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu/nvidia/current:${LD_LIBRARY_PATH}
ENV LIBRARY_PATH=${CUDA_HOME}/lib64/stubs:/usr/local/lib/python3.8/site-packages/open3d:/usr/lib:/usr/lib64:${LIBRARY_PATH}

# Set home to the user's home directory
ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH \
    PYTHONPATH=$HOME/app:$PYTHONPATH \
    PYTHONUNBUFFERED=1 \
    GRADIO_ALLOW_FLAGGING=never \
    GRADIO_NUM_PORTS=1 \
    GRADIO_SERVER_NAME=0.0.0.0 \
    GRADIO_THEME=huggingface \
    SYSTEM=spaces

RUN pip install --upgrade pip setuptools ninja
RUN pip install torch==2.3.1+cu121 -f https://download.pytorch.org/whl/cu113/torch_stable.html

RUN python -c "import torch; print(torch.version.cuda)"
COPY requirements.txt /tmp
RUN cd /tmp && pip install -r requirements.txt

RUN chmod 777 $HOME
ENV TRANSFORMERS_CACHE=/tmp
ENV MPLCONFIGDIR=/tmp

# Copy the current directory contents into the container at $HOME/app setting the owner to the user
COPY --chown=user . $HOME/app

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

CMD ["python", "app.py"]