huanngzh commited on
Commit
58bc4de
·
1 Parent(s): f7a5fbf
Files changed (1) hide show
  1. Dockerfile +9 -15
Dockerfile CHANGED
@@ -3,11 +3,6 @@
3
 
4
  FROM nvidia/cuda:12.1.0-devel-ubuntu22.04
5
 
6
- ARG USER_NAME=hzh
7
- ARG GROUP_NAME=vast
8
- ARG UID=1000
9
- ARG GID=1000
10
-
11
  # Set compute capability for nerfacc and tiny-cuda-nn
12
  # See https://developer.nvidia.com/cuda-gpus and limit number to speed-up build
13
  ENV TORCH_CUDA_ARCH_LIST="6.0 6.1 7.0 7.5 8.0 8.6 8.9 9.0+PTX"
@@ -19,11 +14,6 @@ ENV TCNN_CUDA_ARCHITECTURES=90;89;86;80;75;70;61;60
19
  # ENV TORCH_CUDA_ARCH_LIST="8.9"
20
  # ENV TCNN_CUDA_ARCHITECTURES=89
21
 
22
- ENV CUDA_HOME=/usr/local/cuda
23
- ENV PATH=${CUDA_HOME}/bin:/home/${USER_NAME}/.local/bin:${PATH}
24
- ENV LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH}
25
- ENV LIBRARY_PATH=${CUDA_HOME}/lib64/stubs:${LIBRARY_PATH}
26
-
27
  # apt install by root user
28
  RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
29
  build-essential \
@@ -47,9 +37,13 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-ins
47
  wget \
48
  && rm -rf /var/lib/apt/lists/*
49
 
50
- RUN groupadd -g ${GID} ${GROUP_NAME} \
51
- && useradd -ms /bin/sh -u ${UID} -g ${GID} ${USER_NAME}
52
- USER ${USER_NAME}
 
 
 
 
53
 
54
  WORKDIR /app
55
 
@@ -57,8 +51,8 @@ RUN pip install torch==2.2.1 torchvision==0.17.1 torchaudio==2.2.1 --index-url h
57
  RUN pip install --no-cache-dir datasets "huggingface-hub>=0.19" "hf-transfer>=0.1.4" "protobuf<4" "click<8.1" "pydantic~=1.0"
58
  RUN pip install --no-cache-dir gradio[oauth]==4.44.1 "uvicorn>=0.14.0" spaces
59
 
60
- COPY --chown=${USER_NAME} ./requirements.txt requirements.txt
61
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
62
 
63
- COPY --chown=${USER_NAME} . /app
64
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
3
 
4
  FROM nvidia/cuda:12.1.0-devel-ubuntu22.04
5
 
 
 
 
 
 
6
  # Set compute capability for nerfacc and tiny-cuda-nn
7
  # See https://developer.nvidia.com/cuda-gpus and limit number to speed-up build
8
  ENV TORCH_CUDA_ARCH_LIST="6.0 6.1 7.0 7.5 8.0 8.6 8.9 9.0+PTX"
 
14
  # ENV TORCH_CUDA_ARCH_LIST="8.9"
15
  # ENV TCNN_CUDA_ARCHITECTURES=89
16
 
 
 
 
 
 
17
  # apt install by root user
18
  RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
19
  build-essential \
 
37
  wget \
38
  && rm -rf /var/lib/apt/lists/*
39
 
40
+ RUN useradd -m -u 1000 user
41
+ USER user
42
+
43
+ ENV CUDA_HOME=/usr/local/cuda
44
+ ENV PATH=${CUDA_HOME}/bin:/home/user/.local/bin:${PATH}
45
+ ENV LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH}
46
+ ENV LIBRARY_PATH=${CUDA_HOME}/lib64/stubs:${LIBRARY_PATH}
47
 
48
  WORKDIR /app
49
 
 
51
  RUN pip install --no-cache-dir datasets "huggingface-hub>=0.19" "hf-transfer>=0.1.4" "protobuf<4" "click<8.1" "pydantic~=1.0"
52
  RUN pip install --no-cache-dir gradio[oauth]==4.44.1 "uvicorn>=0.14.0" spaces
53
 
54
+ COPY --chown=user ./requirements.txt requirements.txt
55
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
56
 
57
+ COPY --chown=user . /app
58
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]