Spaces:
Sleeping
Sleeping
| # Use Python 3.13 slim image | |
| FROM python:3.13-slim | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y \ | |
| build-essential \ | |
| curl \ | |
| git \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Install uv | |
| COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv | |
| # Set up a new user named "user" with user ID 1000 (required by HF Spaces) | |
| RUN useradd -m -u 1000 user | |
| # Switch to the "user" user | |
| USER user | |
| # Set home to the user's home directory | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH | |
| # Set the working directory to the user's home directory | |
| WORKDIR $HOME/app | |
| # Copy dependency files first for better caching | |
| COPY --chown=user pyproject.toml uv.lock ./ | |
| # Install dependencies only (exclude local package for now) | |
| RUN uv sync --frozen --no-install-project | |
| # Copy source code | |
| COPY --chown=user src/ ./src/ | |
| # Install the local package (this layer will rebuild when code changes) | |
| RUN uv pip install -e . | |
| # Expose port (default 8501, can be overridden) | |
| EXPOSE 8501 | |
| # Health check | |
| HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health | |
| # Run the application | |
| CMD ["uv", "run", "streamlit", "run", "src/legisqa_local/app.py", "--server.port=8501", "--server.address=0.0.0.0"] |