Spaces:
Sleeping
Sleeping
FROM python:3.9-slim | |
WORKDIR /app | |
# Install system dependencies required by OpenCV and other build tools | |
# libgl1-mesa-glx: Provides libGL.so.1 (OpenGL library) - THIS IS THE KEY FIX | |
# libsm6, libxrender1: Common X11 dependencies often needed by OpenCV | |
# ffmpeg: Good for general video processing capabilities | |
# build-essential, curl, software-properties-common, git: Keep your existing dev tools | |
RUN apt-get update && apt-get install -y \ | |
build-essential \ | |
curl \ | |
software-properties-common \ | |
git \ | |
libgl1-mesa-glx \ | |
libsm6 \ | |
libxrender1 \ | |
ffmpeg \ | |
# Clean up apt caches to reduce image size | |
&& rm -rf /var/lib/apt/lists/* | |
# Copy your requirements.txt file | |
COPY requirements.txt ./ | |
# Install Python dependencies from requirements.txt | |
RUN pip3 install --no-cache-dir -r requirements.txt | |
# Copy your application source code and assets | |
# This assumes your project structure looks something like this: | |
# project_root/ | |
# βββ src/ | |
# β βββ streamlit_app.py (your app.py renamed/moved to here) | |
# βββ models/ | |
# β βββ emotion_model_best.h5 | |
# βββ cascades/ | |
# β βββ haarcascade_frontalface_default.xml | |
# βββ requirements.txt | |
# βββ Dockerfile | |
# | |
# COPY . . copies everything from your project_root into /app in the container. | |
COPY . . | |
EXPOSE 8501 | |
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health | |
# Ensure the entrypoint path is correct for your app within the container | |
# Based on your structure, it's inside 'src/' | |
ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"] |