mphycx commited on
Commit
4c28492
·
1 Parent(s): 5a0a3c7

Add user to fix permission

Browse files
Files changed (1) hide show
  1. Dockerfile +17 -3
Dockerfile CHANGED
@@ -12,8 +12,6 @@ RUN --mount=type=secret,id=OPENAI_API_KEY,mode=0444,required=true \
12
  git init && \
13
  git remote add origin $(cat /run/secrets/OPENAI_API_KEY)
14
 
15
- WORKDIR /app
16
-
17
  COPY requirements_pytorch.txt requirements_pytorch.txt
18
  COPY requirements_api.txt requirements_api.txt
19
  COPY requirements_app.txt requirements_app.txt
@@ -22,10 +20,26 @@ RUN pip3 install -r requirements_pytorch.txt
22
  RUN pip3 install -r requirements_api.txt
23
  RUN pip3 install -r requirements_app.txt
24
 
25
- COPY intfloat /app/intfloat
26
  COPY app.py app.py
27
  COPY api.py api.py
28
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  EXPOSE 7860
30
  EXPOSE 8080
31
 
 
12
  git init && \
13
  git remote add origin $(cat /run/secrets/OPENAI_API_KEY)
14
 
 
 
15
  COPY requirements_pytorch.txt requirements_pytorch.txt
16
  COPY requirements_api.txt requirements_api.txt
17
  COPY requirements_app.txt requirements_app.txt
 
20
  RUN pip3 install -r requirements_api.txt
21
  RUN pip3 install -r requirements_app.txt
22
 
23
+ COPY intfloat /intfloat
24
  COPY app.py app.py
25
  COPY api.py api.py
26
 
27
+ # Set up a new user named "user" with user ID 1000
28
+ RUN useradd -m -u 1000 user
29
+
30
+ # Switch to the "user" user
31
+ USER user
32
+
33
+ # Set home to the user's home directory
34
+ ENV HOME=/home/user \
35
+ PATH=/home/user/.local/bin:$PATH
36
+
37
+ # Set the working directory to the user's home directory
38
+ WORKDIR $HOME/app
39
+
40
+ # Copy the current directory contents into the container at $HOME/app setting the owner to the user
41
+ COPY --chown=user . $HOME/app
42
+
43
  EXPOSE 7860
44
  EXPOSE 8080
45