Spaces:
Sleeping
Sleeping
FROM python:3.9-slim | |
WORKDIR /app | |
# Create cache and config directories with permissions | |
RUN mkdir -p /tmp/huggingface/hub \ | |
&& mkdir -p /tmp/pretrained_models \ | |
&& mkdir -p /app/.streamlit \ | |
&& chmod -R 777 /tmp/huggingface \ | |
&& chmod -R 777 /tmp/pretrained_models \ | |
&& chmod -R 777 /app/. | |
# Set environment variables | |
ENV TRANSFORMERS_CACHE=/tmp/huggingface | |
ENV HF_HOME=/tmp/huggingface | |
ENV XDG_CACHE_HOME=/app/.streamlit | |
ENV HOME=/app | |
# Install dependencies | |
RUN apt-get update && apt-get install -y \ | |
build-essential \ | |
ffmpeg \ | |
curl \ | |
software-properties-common \ | |
git \ | |
&& rm -rf /var/lib/apt/lists/* | |
# Install Python packages | |
COPY requirements.txt ./ | |
RUN pip install --no-cache-dir -r requirements.txt | |
# Copy app files | |
COPY app.py ./ | |
COPY utils/ ./utils/ | |
COPY models/ ./models/ | |
COPY .streamlit/ .streamlit/ | |
# Fix permissions after copying files | |
RUN chmod -R 777 /tmp/huggingface \ | |
&& chmod -R 777 /tmp/pretrained_models \ | |
&& chmod -R 777 /app/.streamlit | |
EXPOSE 8501 | |
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1 | |
ENTRYPOINT ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"] | |