ashish6318 commited on
Commit
ba9d3bd
·
verified ·
1 Parent(s): 5509e21

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -4
Dockerfile CHANGED
@@ -5,10 +5,14 @@ FROM python:3.9-slim
5
  WORKDIR /app
6
 
7
  # Install system dependencies
8
- RUN apt-get update && apt-get install -y \
 
 
 
 
9
  build-essential \
10
  curl \
11
- libgl1-mesa-glx \ # Added this line for OpenCV dependency
12
  && rm -rf /var/lib/apt/lists/*
13
 
14
  # Copy the requirements file first to leverage Docker cache
@@ -19,15 +23,17 @@ COPY requirements.txt ./
19
  RUN pip3 install --no-cache-dir -r requirements.txt
20
 
21
  # Create necessary subdirectories within /app for your application's structure
 
22
  RUN mkdir -p /app/face_detector /app/css /app/images
23
 
24
- # Copy your application files into the container, placing them in the correct subdirectories
 
25
  COPY app.py ./app.py
26
  COPY deploy.prototxt /app/face_detector/deploy.prototxt
27
  COPY res10_300x300_ssd_iter_140000.caffemodel /app/face_detector/res10_300x300_ssd_iter_140000.caffemodel
28
  COPY mask_detector.h5 ./mask_detector.h5
29
  COPY styles.css /app/css/styles.css
30
- COPY out.jpg /app/images/out.jpg
31
 
32
  # Expose the port Streamlit runs on (default is 8501)
33
  EXPOSE 8501
@@ -36,4 +42,5 @@ EXPOSE 8501
36
  HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
37
 
38
  # Set the entrypoint to run the Streamlit application
 
39
  ENTRYPOINT ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]
 
5
  WORKDIR /app
6
 
7
  # Install system dependencies
8
+ # - build-essential: for compiling Python packages if needed
9
+ # - curl: for the healthcheck
10
+ # - libgl1-mesa-glx: dependency for OpenCV (to fix libGL.so.1 error)
11
+ RUN apt-get update && \
12
+ apt-get install -y \
13
  build-essential \
14
  curl \
15
+ libgl1-mesa-glx \
16
  && rm -rf /var/lib/apt/lists/*
17
 
18
  # Copy the requirements file first to leverage Docker cache
 
23
  RUN pip3 install --no-cache-dir -r requirements.txt
24
 
25
  # Create necessary subdirectories within /app for your application's structure
26
+ # These directories will hold your models, CSS, and images
27
  RUN mkdir -p /app/face_detector /app/css /app/images
28
 
29
+ # Copy your application files into the container,
30
+ # placing them in the correct subdirectories as expected by app.py
31
  COPY app.py ./app.py
32
  COPY deploy.prototxt /app/face_detector/deploy.prototxt
33
  COPY res10_300x300_ssd_iter_140000.caffemodel /app/face_detector/res10_300x300_ssd_iter_140000.caffemodel
34
  COPY mask_detector.h5 ./mask_detector.h5
35
  COPY styles.css /app/css/styles.css
36
+ COPY out.jpg /app/images/out.jpg # Copies the out.jpg from your repo
37
 
38
  # Expose the port Streamlit runs on (default is 8501)
39
  EXPOSE 8501
 
42
  HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
43
 
44
  # Set the entrypoint to run the Streamlit application
45
+ # This will execute: streamlit run app.py --server.port=8501 --server.address=0.0.0.0
46
  ENTRYPOINT ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]