kidcoconut commited on
Commit
19d6e02
·
1 Parent(s): 0c31d60

updated Dockerfile to handle root vs user permissions

Browse files
Files changed (1) hide show
  1. Dockerfile +14 -14
Dockerfile CHANGED
@@ -7,32 +7,32 @@
7
  FROM python:3.10.9-slim-bullseye
8
 
9
 
10
- # Set up a new user named "user" with user ID 1000
11
- RUN useradd -m -u 1000 user
12
-
13
- # Switch to the "user" user
14
- USER user
15
-
16
- # Set home to the user's home directory
17
- ENV HOME=/home/user \
18
- PATH=/home/user/.local/bin:$PATH
19
-
20
-
21
  #--- copy only the requirements.txt file
22
  #--- set docker image working directory to /app
23
  #--- Not: this is reorg'd in an attempt to reduce the rebuilding of layers
24
- COPY --chown=user ./requirements.txt $HOME/app/requirements.txt
25
 
26
  #--- set docker image working directory to /app
27
- WORKDIR $HOME/app
 
28
 
29
  #--- install all lib dependencies into the image
30
  RUN pip3 install -r ./requirements.txt
31
  RUN apt-get update && apt-get install ffmpeg libsm6 libxext6 -y
32
 
 
 
 
 
 
 
 
 
 
 
33
  #--- copy all files from the local pwd to the docker image /app folder
34
  #--- .dockerignore: ensure no local data folders or files (images) are copied into the docker image/container
35
- COPY --chown=user . $HOME/app
36
 
37
  #--- for streamlit; external 49400; internal 39400
38
  # localExec: (from root folder) streamlit run app.py --server.port=39400 --server.maxUploadSize=2000
 
7
  FROM python:3.10.9-slim-bullseye
8
 
9
 
 
 
 
 
 
 
 
 
 
 
 
10
  #--- copy only the requirements.txt file
11
  #--- set docker image working directory to /app
12
  #--- Not: this is reorg'd in an attempt to reduce the rebuilding of layers
13
+ COPY ./requirements.txt /app/requirements.txt
14
 
15
  #--- set docker image working directory to /app
16
+ WORKDIR /app
17
+ RUN chmod 777 /app
18
 
19
  #--- install all lib dependencies into the image
20
  RUN pip3 install -r ./requirements.txt
21
  RUN apt-get update && apt-get install ffmpeg libsm6 libxext6 -y
22
 
23
+
24
+ # Set up a new user named "user" with user ID 1000
25
+ # Switch to the "user" user
26
+ RUN useradd -m -u 1000 user
27
+ USER user
28
+
29
+ # Set home to the user's home directory
30
+ ENV HOME=/home/user \
31
+ PATH=/home/user/.local/bin:$PATH
32
+
33
  #--- copy all files from the local pwd to the docker image /app folder
34
  #--- .dockerignore: ensure no local data folders or files (images) are copied into the docker image/container
35
+ COPY --chown=user . /app
36
 
37
  #--- for streamlit; external 49400; internal 39400
38
  # localExec: (from root folder) streamlit run app.py --server.port=39400 --server.maxUploadSize=2000