chaoxu commited on
Commit
f391898
·
1 Parent(s): 225cd88

set up user in Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +21 -0
Dockerfile CHANGED
@@ -48,4 +48,25 @@ RUN pip3 install --no-cache-dir \
48
  inplace_abn \
49
  git+https://github.com/mit-han-lab/[email protected]
50
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  CMD ["python3", "app.py"]
 
48
  inplace_abn \
49
  git+https://github.com/mit-han-lab/[email protected]
50
 
51
+
52
+ # Set up a new user named "user" with user ID 1000
53
+ RUN useradd -m -u 1000 user
54
+ # Switch to the "user" user
55
+ USER user
56
+ # Set home to the user's home directory
57
+ ENV HOME=/home/user \
58
+ PATH=/home/user/.local/bin:$PATH \
59
+ PYTHONPATH=$HOME/app \
60
+ PYTHONUNBUFFERED=1 \
61
+ SYSTEM=spaces
62
+
63
+ RUN pip3 install --no-cache-dir --upgrade -r /code/requirements.txt
64
+
65
+ # Set the working directory to the user's home directory
66
+ WORKDIR $HOME/app
67
+
68
+ # Copy the current directory contents into the container at $HOME/app setting the owner to the user
69
+ COPY --chown=user . $HOME/app
70
+
71
+
72
  CMD ["python3", "app.py"]