Spaces:
Sleeping
Sleeping
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 \ | |
&& rm -rf /var/lib/apt/lists/* | |
# Set environment variables to redirect cache to local directory (avoids permission issues) | |
ENV XDG_CACHE_HOME=/app/.cache | |
ENV TRANSFORMERS_CACHE=/app/.cache | |
ENV HF_HOME=/app/.cache | |
ENV STREAMLIT_CONFIG_DIR=/app/.streamlit | |
# Create cache and config directories with open permissions | |
RUN mkdir -p /app/.cache /app/.streamlit && chmod -R 777 /app | |
# Copy requirements and app code | |
COPY requirements.txt ./ | |
COPY src/ ./src/ | |
# Install Python dependencies | |
RUN pip install --no-cache-dir -r requirements.txt | |
# Expose Streamlit default port | |
EXPOSE 8501 | |
# Healthcheck for Hugging Face Spaces | |
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1 | |
# Run Streamlit app | |
ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"] | |