Harshdhsvguyt commited on
Commit
733c8bd
·
verified ·
1 Parent(s): fad0119

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +23 -3
Dockerfile CHANGED
@@ -13,12 +13,32 @@ RUN pip3 install -r requirements.txt
13
 
14
  COPY src/ ./src/
15
 
16
- # Disable Streamlit telemetry completely
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  ENV STREAMLIT_BROWSER_GATHER_USAGE_STATS=false
18
- ENV STREAMLIT_TELEMETRY=false
19
 
20
  EXPOSE 8501
21
 
22
  HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
23
 
24
- ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0", "--browser.gatherUsageStats=false"]
 
 
 
 
 
13
 
14
  COPY src/ ./src/
15
 
16
+ # Create writable .streamlit folder with proper permissions
17
+ RUN mkdir -p /app/.streamlit && chmod 755 /app/.streamlit
18
+
19
+ # Add Streamlit config to disable usage stats collection
20
+ RUN echo "[browser]\ngatherUsageStats = false\n[server]\nheadless = true\nport = 8501\nenableCORS = false\nenableXsrfProtection = false\n" > /app/.streamlit/config.toml
21
+
22
+ # Set proper permissions for the config file
23
+ RUN chmod 644 /app/.streamlit/config.toml
24
+
25
+ # Create a non-root user for better security
26
+ RUN useradd -m -u 1000 streamlit && chown -R streamlit:streamlit /app
27
+
28
+ # Switch to non-root user
29
+ USER streamlit
30
+
31
+ # Set environment variables
32
+ ENV STREAMLIT_CONFIG_DIR=/app/.streamlit
33
+ ENV HOME=/app
34
  ENV STREAMLIT_BROWSER_GATHER_USAGE_STATS=false
 
35
 
36
  EXPOSE 8501
37
 
38
  HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
39
 
40
+ # Replace with your actual file path - common alternatives:
41
+ # ENTRYPOINT ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]
42
+ # ENTRYPOINT ["streamlit", "run", "main.py", "--server.port=8501", "--server.address=0.0.0.0"]
43
+ # ENTRYPOINT ["streamlit", "run", "src/app.py", "--server.port=8501", "--server.address=0.0.0.0"]
44
+ ENTRYPOINT ["streamlit", "run", "streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]