FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim # Set proper terminal environment for Textual ENV TERM=xterm-256color ENV COLORTERM=truecolor ENV PYTHONUNBUFFERED=1 # HF Spaces will set SPACE_HOST automatically, but we can provide a fallback ENV SPACE_HOST=${SPACE_HOST:-http://localhost:7860} # Install system dependencies (git needed for GitHub installs) RUN apt-get update && apt-get install -y \ git \ && rm -rf /var/lib/apt/lists/* # Create app directory WORKDIR /app # Create a virtual environment using uv RUN uv venv .venv # Copy requirements and install Python dependencies into the venv COPY requirements.txt . RUN uv pip install -r requirements.txt # Copy the entire textual-app directory containing all app files COPY textual-app/ ./textual-app/ # Copy the main server file COPY serve.py . # Activate the virtual environment by putting it in PATH ENV PATH="/app/.venv/bin:$PATH" # Expose the port that HF Spaces expects EXPOSE 7860 # Run the server with the venv's Python CMD ["python", "serve.py"]