PorYoung commited on
Commit
7374337
1 Parent(s): 0973339

switch to user

Browse files
Files changed (1) hide show
  1. Dockerfile +19 -5
Dockerfile CHANGED
@@ -4,17 +4,31 @@ RUN apt update
4
  RUN apt install -y git libsndfile1-dev python3 python3-dev python3-pip ffmpeg
5
  RUN python3 -m pip install --no-cache-dir --upgrade pip
6
 
7
- WORKDIR /work
8
- COPY . .
9
- RUN cd /work/so-vits-svc/pretrain && \
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  wget -c https://github.com/openvpi/vocoders/releases/download/nsf-hifigan-v1/nsf_hifigan_20221211.zip && \
11
  unzip -q nsf_hifigan_20221211.zip
12
 
13
- RUN pip install --no-cache-dir --upgrade -r /work/so-vits-svc/requirements.txt
14
 
15
  ENV SERVER_NAME="0.0.0.0"
16
  ENV SERVER_PORT=7860
17
 
18
- WORKDIR /work/so-vits-svc
19
 
20
  CMD ["python3", "webUI.py"]
 
4
  RUN apt install -y git libsndfile1-dev python3 python3-dev python3-pip ffmpeg
5
  RUN python3 -m pip install --no-cache-dir --upgrade pip
6
 
7
+ # Set up a new user named "user" with user ID 1000
8
+ RUN useradd -m -u 1000 user
9
+
10
+ # Switch to the "user" user
11
+ USER user
12
+
13
+ # Set home to the user's home directory
14
+ ENV HOME=/home/user \
15
+ PATH=/home/user/.local/bin:$PATH
16
+
17
+ # Set the working directory to the user's home directory
18
+ WORKDIR $HOME/
19
+
20
+ # Copy the current directory contents into the container at $HOME/app setting the owner to the user
21
+ COPY --chown=user . .
22
+
23
+ RUN cd $HOME/so-vits-svc/pretrain && \
24
  wget -c https://github.com/openvpi/vocoders/releases/download/nsf-hifigan-v1/nsf_hifigan_20221211.zip && \
25
  unzip -q nsf_hifigan_20221211.zip
26
 
27
+ RUN pip install --no-cache-dir --upgrade -r $HOME/so-vits-svc/requirements.txt
28
 
29
  ENV SERVER_NAME="0.0.0.0"
30
  ENV SERVER_PORT=7860
31
 
32
+ WORKDIR $HOME/so-vits-svc
33
 
34
  CMD ["python3", "webUI.py"]