parkerjj commited on
Commit
c237b52
·
1 Parent(s): 01dcd9c

更新 Dockerfile,启用用户创建和切换,设置用户环境变量和工作目录

Browse files
Files changed (1) hide show
  1. Dockerfile +6 -6
Dockerfile CHANGED
@@ -15,18 +15,18 @@ RUN pip install --no-cache-dir --upgrade -r /app/requirements.txt
15
  EXPOSE 7860
16
 
17
  # Set up a new user named "user" with user ID 1000
18
- #RUN useradd -m -u 1000 user
19
  # Switch to the "user" user
20
- #USER user
21
  # Set home to the user's home directory
22
- #ENV HOME=/home/user \
23
- # PATH=/home/user/.local/bin:$PATH
24
 
25
  # Set the working directory to the user's home directory
26
- #WORKDIR $HOME/app
27
 
28
  # Copy the current directory contents into the container at $HOME/app setting the owner to the user
29
- #COPY --chown=user . $HOME/app
30
 
31
 
32
  # Get secret EXAMPLE and output it to /test at buildtime
 
15
  EXPOSE 7860
16
 
17
  # Set up a new user named "user" with user ID 1000
18
+ RUN useradd -m -u 1000 user
19
  # Switch to the "user" user
20
+ USER user
21
  # Set home to the user's home directory
22
+ ENV HOME=/home/user \
23
+ PATH=/home/user/.local/bin:$PATH
24
 
25
  # Set the working directory to the user's home directory
26
+ WORKDIR $HOME/app
27
 
28
  # Copy the current directory contents into the container at $HOME/app setting the owner to the user
29
+ COPY --chown=user . $HOME/app
30
 
31
 
32
  # Get secret EXAMPLE and output it to /test at buildtime