File size: 1,124 Bytes
3d1e659 06d3956 3d1e659 06d3956 3d1e659 06d3956 b9fcd15 06d3956 48fc634 3d1e659 06d3956 3d1e659 06d3956 82f5dae 3d1e659 06d3956 3d1e659 06d3956 3d1e659 06d3956 |
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 |
# Use Python 3.9 slim as the base image
FROM python:3.9-slim
# Set working directory
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
build-essential \
curl \
software-properties-common \
git \
libgl1-mesa-glx \
libglib2.0-0 \
espeak \
&& rm -rf /var/lib/apt/lists/*
# Create a directory for MediaPipe models and set permissions
RUN mkdir -p /app/mediapipe_models && chmod -R 777 /app/mediapipe_models
# Set environment variable to redirect MediaPipe model downloads
ENV MEDIAPIPE_CACHE_DIR=/app/mediapipe_models
# Copy requirements and source code
COPY requirements.txt ./
COPY src/ ./src/
# Install Python dependencies
RUN pip3 install --no-cache-dir -r requirements.txt
# Create a non-root user and set ownership
RUN useradd -m appuser && chown -R appuser:appuser /app
USER appuser
# Expose Streamlit port
EXPOSE 8501
# Healthcheck for Hugging Face Spaces
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
# Run Streamlit
ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"] |