File size: 1,032 Bytes
52ba85b
 
e498871
 
 
 
 
051c49d
 
 
52ba85b
e498871
4f61dd1
e498871
 
 
 
 
52ba85b
 
 
 
e498871
f0f897c
e498871
344f184
 
 
 
bb50ef7
e498871
52ba85b
 
 
e498871
 
 
52ba85b
07ff3f0
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
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"]