File size: 1,073 Bytes
e812ccd
 
5d343bf
e812ccd
5d343bf
 
 
 
 
 
e812ccd
 
 
44d2f53
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5d343bf
9f9da04
 
5d343bf
e812ccd
5d343bf
 
e812ccd
5d343bf
 
e812ccd
44d2f53
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
# 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 project files with proper ownership
COPY --chown=user pyproject.toml uv.lock ./
COPY --chown=user src/ ./src/

# Install dependencies and the package
RUN uv sync --frozen && 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 ["sh", "-c", "uv run streamlit run src/legisqa_local/app.py --server.port=${PORT:-8501} --server.address=0.0.0.0"]