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