Spaces:
Sleeping
Sleeping
FROM python:3.9-slim | |
WORKDIR /app | |
# Set environment variables early | |
ENV HOME=/app | |
ENV TRANSFORMERS_CACHE=/app/.cache/huggingface/hub | |
ENV XDG_CACHE_HOME=/app/.streamlit | |
# Install system dependencies | |
RUN apt-get update && apt-get install -y \ | |
build-essential \ | |
ffmpeg \ | |
curl \ | |
software-properties-common \ | |
git \ | |
&& rm -rf /var/lib/apt/lists/* | |
# Create writable cache directories | |
RUN mkdir -p /app/.cache/huggingface/hub /app/.streamlit && \ | |
chmod -R 777 /app/.cache /app/.streamlit | |
# Copy Python dependencies | |
COPY requirements.txt ./ | |
RUN pip3 install --no-cache-dir -r requirements.txt | |
# Copy application files | |
COPY app.py ./ | |
COPY utils/ ./utils/ | |
COPY models/ ./models/ | |
COPY .streamlit/ .streamlit/ | |
EXPOSE 8501 | |
# Optional health check for Streamlit | |
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1 | |
# Run the Streamlit app | |
ENTRYPOINT ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"] | |