samim2024 commited on
Commit
d5aeacb
·
verified ·
1 Parent(s): 0a1db48

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +15 -2
Dockerfile CHANGED
@@ -1,15 +1,28 @@
1
  FROM python:3.9-slim
2
 
 
 
 
3
  WORKDIR /app
4
 
 
5
  COPY requirements.txt .
6
  RUN pip install --no-cache-dir -r requirements.txt
7
 
 
 
 
 
 
 
8
  COPY . .
9
 
10
- # Set default port, override with environment variable if needed
 
 
 
11
  ENV PORT=8501
12
 
13
  EXPOSE 8501
14
 
15
- CMD streamlit run app.py --server.port ${PORT}
 
1
  FROM python:3.9-slim
2
 
3
+ # Create non-root user for security
4
+ RUN useradd -m appuser && mkdir -p /app && chown -R appuser:appuser /app
5
+
6
  WORKDIR /app
7
 
8
+ # Install dependencies
9
  COPY requirements.txt .
10
  RUN pip install --no-cache-dir -r requirements.txt
11
 
12
+ # Create .streamlit directory and config file
13
+ RUN mkdir -p /app/.streamlit && chown appuser:appuser /app/.streamlit
14
+ COPY .streamlit/config.toml /app/.streamlit/
15
+ RUN chown appuser:appuser /app/.streamlit/config.toml
16
+
17
+ # Copy application files
18
  COPY . .
19
 
20
+ # Switch to non-root user
21
+ USER appuser
22
+
23
+ # Set default port
24
  ENV PORT=8501
25
 
26
  EXPOSE 8501
27
 
28
+ CMD streamlit run app.py --server.port ${PORT} --server.fileWatcherType=none