alvanlii commited on
Commit
e5a3ef5
·
1 Parent(s): 6d721db

Try to fix user permissions

Browse files
Files changed (1) hide show
  1. Dockerfile +8 -3
Dockerfile CHANGED
@@ -11,14 +11,19 @@ FROM nvcr.io/nvidia/pytorch:20.12-py3
11
  ENV PYTHONDONTWRITEBYTECODE 1
12
  ENV PYTHONUNBUFFERED 1
13
 
 
 
 
 
 
14
  RUN apt install -y git
15
 
16
  RUN pip install imageio-ffmpeg==0.4.3 pyspng==0.1.0
17
 
18
  WORKDIR /exp/domain-expansion
19
 
20
- COPY ./requirements.txt /exp/domain-expansion/requirements.txt
21
- RUN python -m pip install --no-cache-dir --upgrade -r /exp/domain-expansion/requirements.txt
22
 
23
  RUN python -m pip uninstall -y gradio
24
  RUN python -m pip install -U pip setuptools wheel
@@ -30,5 +35,5 @@ RUN python -m pip install gradio
30
  RUN (printf '#!/bin/bash\nunset TORCH_CUDA_ARCH_LIST\nexec \"$@\"\n' >> /entry.sh) && chmod a+x /entry.sh
31
  ENTRYPOINT ["/entry.sh"]
32
 
33
- COPY . .
34
  CMD ["uvicorn", "app:main", "--host", "0.0.0.0", "--port", "7860"]
 
11
  ENV PYTHONDONTWRITEBYTECODE 1
12
  ENV PYTHONUNBUFFERED 1
13
 
14
+ RUN useradd -m -u 1000 user
15
+ # Switch to the "user" user
16
+ USER user
17
+ ENV HOME=/exp/domain-expansion
18
+
19
  RUN apt install -y git
20
 
21
  RUN pip install imageio-ffmpeg==0.4.3 pyspng==0.1.0
22
 
23
  WORKDIR /exp/domain-expansion
24
 
25
+ COPY ./requirements.txt $HOME/requirements.txt
26
+ RUN python -m pip install --no-cache-dir --upgrade -r $HOME/requirements.txt
27
 
28
  RUN python -m pip uninstall -y gradio
29
  RUN python -m pip install -U pip setuptools wheel
 
35
  RUN (printf '#!/bin/bash\nunset TORCH_CUDA_ARCH_LIST\nexec \"$@\"\n' >> /entry.sh) && chmod a+x /entry.sh
36
  ENTRYPOINT ["/entry.sh"]
37
 
38
+ COPY --chown=user . .
39
  CMD ["uvicorn", "app:main", "--host", "0.0.0.0", "--port", "7860"]