muskan19 commited on
Commit
a42185d
·
verified ·
1 Parent(s): f50ac90

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +26 -13
Dockerfile CHANGED
@@ -1,26 +1,39 @@
1
 
2
- FROM python:3.9-slim
 
3
 
 
4
  WORKDIR /app
5
 
 
6
  RUN apt-get update && apt-get install -y \
7
  build-essential \
8
  curl \
9
- software-properties-common \
10
  git \
 
11
  && rm -rf /var/lib/apt/lists/*
12
 
13
- COPY requirements.txt ./
14
- COPY app.py ./
15
- COPY src/ ./src/
16
-
17
- # This helps Streamlit avoid writing to restricted locations
18
- ENV XDG_CONFIG_HOME=/tmp
19
-
20
- RUN pip3 install -r requirements.txt
21
-
 
 
 
 
 
 
 
 
 
 
22
  EXPOSE 8501
23
 
24
- HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
25
-
26
  ENTRYPOINT ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]
 
 
1
 
2
+ # Use a full Python base image (better compatibility with TensorFlow and OpenCV)
3
+ FROM python:3.9
4
 
5
+ # Set the working directory in the container
6
  WORKDIR /app
7
 
8
+ # Install system dependencies
9
  RUN apt-get update && apt-get install -y \
10
  build-essential \
11
  curl \
 
12
  git \
13
+ libgl1-mesa-glx \
14
  && rm -rf /var/lib/apt/lists/*
15
 
16
+ # Copy all project files into the container
17
+ COPY . .
18
+
19
+ # Create .streamlit config directory and disable usage stats (prevent permission issues)
20
+ RUN mkdir -p /app/.streamlit && \
21
+ echo "\
22
+ [server]\n\
23
+ headless = true\n\
24
+ enableCORS = false\n\
25
+ port = 8501\n\
26
+ \n\
27
+ [browser]\n\
28
+ gatherUsageStats = false\n\
29
+ " > /app/.streamlit/config.toml
30
+
31
+ # Install Python dependencies
32
+ RUN pip install --no-cache-dir -r requirements.txt
33
+
34
+ # Expose Streamlit port
35
  EXPOSE 8501
36
 
37
+ # Start the Streamlit app
 
38
  ENTRYPOINT ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]
39
+