Prabhav619 commited on
Commit
e387b11
·
verified ·
1 Parent(s): fedeeb0

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +18 -12
Dockerfile CHANGED
@@ -1,41 +1,47 @@
1
  FROM python:3.13.5-slim
2
 
 
3
  WORKDIR /app
4
 
5
- # Install essential packages
6
  RUN apt-get update && apt-get install -y \
7
  build-essential \
8
  curl \
9
  git \
10
  && rm -rf /var/lib/apt/lists/*
11
 
12
- # Copy dependencies first
13
  COPY requirements.txt ./
14
- RUN pip install --no-cache-dir -r requirements.txt
15
-
16
- # Copy source code
17
  COPY src/ ./src/
18
 
19
- # Create Streamlit directory INSIDE container
20
- RUN mkdir -p /root/.streamlit && chmod -R 777 /root/.streamlit
21
 
22
- # Disable telemetry and set server mode
 
 
 
23
  RUN echo "\
24
  [server]\n\
25
  headless = true\n\
26
  port = 8501\n\
27
  enableCORS = false\n\
 
28
  \n\
29
  [browser]\n\
30
  gatherUsageStats = false\n\
31
- " > /root/.streamlit/config.toml
 
 
 
 
32
 
33
- # Expose Streamlit port
34
  EXPOSE 8501
35
 
36
- # Health check
37
  HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
38
 
39
- # Run Streamlit app
40
  ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]
41
 
 
1
  FROM python:3.13.5-slim
2
 
3
+ # Set working directory
4
  WORKDIR /app
5
 
6
+ # Install system dependencies
7
  RUN apt-get update && apt-get install -y \
8
  build-essential \
9
  curl \
10
  git \
11
  && rm -rf /var/lib/apt/lists/*
12
 
13
+ # Copy project files
14
  COPY requirements.txt ./
 
 
 
15
  COPY src/ ./src/
16
 
17
+ # Install Python dependencies
18
+ RUN pip install --no-cache-dir -r requirements.txt
19
 
20
+ # Create a Streamlit config directory INSIDE /app and make it fully writable
21
+ RUN mkdir -p /app/.streamlit && chmod -R 777 /app/.streamlit
22
+
23
+ # ✅ Add a Streamlit config file that disables telemetry and sets port/address
24
  RUN echo "\
25
  [server]\n\
26
  headless = true\n\
27
  port = 8501\n\
28
  enableCORS = false\n\
29
+ address = 0.0.0.0\n\
30
  \n\
31
  [browser]\n\
32
  gatherUsageStats = false\n\
33
+ " > /app/.streamlit/config.toml
34
+
35
+ # ✅ Tell Streamlit to use /app/.streamlit as its home directory
36
+ ENV STREAMLIT_HOME=/app/.streamlit
37
+ ENV HOME=/app
38
 
39
+ # Expose the Streamlit port
40
  EXPOSE 8501
41
 
42
+ # Health check (optional)
43
  HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
44
 
45
+ # Run Streamlit
46
  ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]
47