TaahKay's picture
Update Dockerfile
b6dff27 verified
raw
history blame
1.13 kB
FROM python:3.9-slim
WORKDIR /app
# Create both cache directories with full permissions
RUN mkdir -p /tmp/huggingface/hub \
&& mkdir -p /app/.streamlit \
&& chmod -R 777 /tmp/huggingface \
&& chmod -R 777 /app/.streamlit
# Set environment variables for both Streamlit and Hugging Face
ENV TRANSFORMERS_CACHE=/tmp/huggingface
ENV HF_HOME=/tmp/huggingface
ENV XDG_CACHE_HOME=/app/.streamlit
ENV HOME=/app
# Install system-level packages
RUN apt-get update && apt-get install -y \
build-essential \
ffmpeg \
curl \
software-properties-common \
git \
&& rm -rf /var/lib/apt/lists/*
# Install Python dependencies
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
# Copy application files
COPY app.py ./
COPY utils/ ./utils/
COPY models/ ./models/
COPY .streamlit/ .streamlit/
# Ensure permissions are still correct
RUN chmod -R 777 /tmp/huggingface \
&& 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"]