DataScience313/Human_Emotion_Detection
0
1FROM python:3.9-slim2 3ENV STREAMLIT_HOME=/home/appuser/.streamlit \4 MPLCONFIGDIR=/home/appuser/.config/matplotlib \5 PYTHONUNBUFFERED=16 7# Create a non-root user8RUN useradd -m appuser9 10WORKDIR /app11 12# Install system dependencies13RUN apt-get update && apt-get install -y \14 build-essential \15 curl \16 git \17 libgl1 \18 libglib2.0-0 \19 && rm -rf /var/lib/apt/lists/*20 21# Copy project files22COPY requirements.txt ./ 23COPY app.py ./ 24COPY model.h5 ./25 26# Create Streamlit config for Hugging Face compatibility27RUN mkdir -p /home/appuser/.streamlit && \28 echo "\29[server]\n\30headless = true\n\31enableCORS = false\n\32enableXsrfProtection = false\n\33enableWebsocketCompression = false\n\34port = 8501\n\35" > /home/appuser/.streamlit/config.toml36 37# Install Python dependencies38RUN pip install --no-cache-dir -r requirements.txt39 40# Set permissions41RUN mkdir -p $STREAMLIT_HOME $MPLCONFIGDIR && \42 chown -R appuser:appuser /home/appuser /app43 44# Use non-root user45USER appuser46 47EXPOSE 850148 49# Healthcheck (optional)50HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 151 52# Start Streamlit53ENTRYPOINT ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]54 