rohitdiwane commited on
Commit
1cbfe64
·
verified ·
1 Parent(s): 8d3075c

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +26 -20
Dockerfile CHANGED
@@ -1,37 +1,43 @@
 
1
  FROM python:3.13.5-slim
2
 
3
- # Install system dependencies
4
- RUN apt-get update && apt-get install -y wget git build-essential curl \
5
- && rm -rf /var/lib/apt/lists/*
6
-
7
- # Create non-root user
8
- RUN useradd -m appuser
9
-
10
- USER appuser
11
  WORKDIR /app
12
 
13
- # Copy code
14
- COPY --chown=appuser:appuser requirements.txt ./
15
- COPY --chown=appuser:appuser src/ ./src/
 
 
 
16
 
17
- # Ensure Python scripts install for the user
18
- ENV PATH="/home/appuser/.local/bin:${PATH}"
 
19
 
20
- RUN pip install --user --no-cache-dir -r requirements.txt
 
21
 
22
- # Streamlit configuration
23
  RUN mkdir -p /app/.streamlit && chmod -R 777 /app/.streamlit
 
 
24
  RUN echo "\
25
  [server]\n\
26
  headless = true\n\
27
- port = 7860\n\
28
  enableCORS = false\n\
29
  enableXsrfProtection = false\n\
30
  \n\
31
- [browser]\ngatherUsageStats = false\n\
 
32
  " > /app/.streamlit/config.toml
33
 
34
- EXPOSE 7860
 
 
 
 
35
 
36
- # Default command to run the Streamlit app
37
- CMD ["streamlit", "run", "src/streamlit_app.py", "--server.port=7860", "--server.address=0.0.0.0"]
 
1
+ # ===== Base Image =====
2
  FROM python:3.13.5-slim
3
 
4
+ # ===== Working Directory =====
 
 
 
 
 
 
 
5
  WORKDIR /app
6
 
7
+ # ===== System dependencies =====
8
+ RUN apt-get update && apt-get install -y \
9
+ build-essential \
10
+ curl \
11
+ git \
12
+ && rm -rf /var/lib/apt/lists/*
13
 
14
+ # ===== Copy project files =====
15
+ COPY requirements.txt ./
16
+ COPY src/ ./src/
17
 
18
+ # ===== Install Python dependencies =====
19
+ RUN pip install --no-cache-dir -r requirements.txt
20
 
21
+ # ===== Create Streamlit config folder with permissions =====
22
  RUN mkdir -p /app/.streamlit && chmod -R 777 /app/.streamlit
23
+
24
+ # ===== Add minimal Streamlit config =====
25
  RUN echo "\
26
  [server]\n\
27
  headless = true\n\
28
+ port = 8501\n\
29
  enableCORS = false\n\
30
  enableXsrfProtection = false\n\
31
  \n\
32
+ [browser]\n\
33
+ gatherUsageStats = false\n\
34
  " > /app/.streamlit/config.toml
35
 
36
+ # ===== Expose port =====
37
+ EXPOSE 8501
38
+
39
+ # ===== Healthcheck =====
40
+ HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
41
 
42
+ # ===== Entrypoint =====
43
+ ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]