legisqa-local / Dockerfile
gabrielaltay's picture
update
44d2f53
raw
history blame
1.07 kB
# 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"]