Spaces:
Build error
Build error
| FROM python:3.10-slim | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y \ | |
| build-essential \ | |
| git \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Create a user with explicit UID 1000 (common for first non-root user) | |
| RUN useradd -m -u 1000 appuser | |
| # Set working directory | |
| WORKDIR /app | |
| # Create directories for various caches with proper permissions | |
| RUN mkdir -p /app/.triton /app/.torch_cache && \ | |
| chown -R appuser:appuser /app | |
| # Set environment variables for cache directories | |
| ENV TRITON_CACHE_DIR=/app/.triton | |
| ENV TORCH_HOME=/app/.torch_cache | |
| ENV TORCHINDUCTOR_CACHE_DIR=/app/.torch_cache/inductor | |
| # Copy requirements first to leverage Docker cache | |
| COPY requirements.txt . | |
| # Install Python dependencies | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy the rest of the application | |
| COPY . . | |
| # Ensure proper ownership of all files | |
| RUN chown -R appuser:appuser /app | |
| # Switch to the appuser | |
| USER appuser | |
| # Expose the port Streamlit runs on | |
| EXPOSE 8501 | |
| # Command to run the application | |
| CMD ["streamlit", "run", "app.py", "--server.address", "0.0.0.0"] |