akhil-vaidya commited on
Commit
34cf8aa
·
verified ·
1 Parent(s): 4c49ec2

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +15 -0
Dockerfile CHANGED
@@ -9,11 +9,26 @@ RUN apt-get update && apt-get install -y \
9
  git \
10
  && rm -rf /var/lib/apt/lists/*
11
 
 
 
 
12
  COPY requirements.txt ./
13
  COPY . ./
14
 
15
  RUN pip3 install -r requirements.txt
16
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  EXPOSE 8501
18
 
19
  HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
 
9
  git \
10
  && rm -rf /var/lib/apt/lists/*
11
 
12
+ # Create a non-root user
13
+ RUN useradd -m -u 1000 streamlit
14
+
15
  COPY requirements.txt ./
16
  COPY . ./
17
 
18
  RUN pip3 install -r requirements.txt
19
 
20
+ # Set permissions for the entire app directory
21
+ RUN chown -R streamlit:streamlit /app
22
+
23
+ # Switch to non-root user
24
+ USER streamlit
25
+
26
+ # Set environment variables
27
+ ENV STREAMLIT_HOME=/app/.streamlit
28
+ ENV STREAMLIT_SERVER_HEADLESS=true
29
+ ENV STREAMLIT_SERVER_ENABLE_CORS=false
30
+ ENV STREAMLIT_SERVER_ENABLE_XSRF_PROTECTION=false
31
+
32
  EXPOSE 8501
33
 
34
  HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health