Spaces:
Sleeping
Sleeping
File size: 1,212 Bytes
e812ccd 5d343bf e812ccd 5d343bf e812ccd 44d2f53 024288c 44d2f53 024288c 271bf40 024288c 44d2f53 5d343bf 024288c 5d343bf e812ccd 5d343bf e812ccd 5d343bf e812ccd ff7384a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# 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"] |