thliang01 commited on
Commit
91870b8
·
unverified ·
1 Parent(s): 691a2b5

chore: Create non-root user in Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +9 -0
Dockerfile CHANGED
@@ -13,6 +13,15 @@ COPY src/ ./src/
13
 
14
  RUN pip3 install -r requirements.txt
15
 
 
 
 
 
 
 
 
 
 
16
  EXPOSE 8501
17
 
18
  HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
 
13
 
14
  RUN pip3 install -r requirements.txt
15
 
16
+ # Create a non-root user and group
17
+ RUN addgroup --system streamlituser && adduser --system --group streamlituser
18
+
19
+ # Change ownership of the working directory to the new user
20
+ RUN chown -R streamlituser:streamlituser /app
21
+
22
+ # Switch to the new non-root user
23
+ USER streamlituser
24
+
25
  EXPOSE 8501
26
 
27
  HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health