File size: 966 Bytes
036a2db
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Use python:3.11-slim as a lightweight base image
FROM python:3.11-slim

# Install system dependencies (git is needed for diffcontext)
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*

# Set up user with UID 1000 (Hugging Face Spaces requirement)
RUN useradd -m -u 1000 user
WORKDIR /app

# Copy configuration and project files
COPY pyproject.toml /app/
COPY README.md /app/
COPY diffcontext /app/diffcontext
COPY diffcontext-service /app/diffcontext-service

# Install package dependencies and extra tools
RUN pip install --no-cache-dir fastapi uvicorn python-multipart mcp sse-starlette .

# Grant write permissions for cached SQLite database and temp directories
RUN chown -R user:user /app

# Switch to the non-root user
USER user

# Expose port 7860 (Hugging Face Spaces requirement)
EXPOSE 7860

# Start the FastAPI server using Uvicorn
CMD ["uvicorn", "diffcontext-service.backend.main:app", "--host", "0.0.0.0", "--port", "7860"]