FinalProject / Dockerfile
Regino
fixed docker
95a3efa
raw
history blame
1.63 kB
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"]