File size: 936 Bytes
2e2fd75
1c56f8e
 
 
 
 
 
 
 
a122f91
 
 
dbbbfec
a122f91
 
dbbbfec
a122f91
1c56f8e
dbbbfec
1c56f8e
 
 
dbbbfec
1c56f8e
 
 
2e2fd75
a122f91
 
2e2fd75
a122f91
 
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
FROM python:3.11-slim

ENV DEBIAN_FRONTEND=noninteractive \
    PYTHONUNBUFFERED=1 \
    PYTHONDONTWRITEBYTECODE=1 \
    PORT=7860

WORKDIR /app

RUN apt-get update && apt-get install -y --no-install-recommends \
    curl \
    && apt-get clean && rm -rf /var/lib/apt/lists/*

# Upgrade build tools
RUN pip install --no-cache-dir --upgrade pip setuptools wheel

# Install dependencies (no heavy CUDA packages needed for LangChain HF Endpoint!)
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

COPY . .

RUN useradd -m -u 1000 appuser && chown -R appuser:appuser /app
USER appuser

EXPOSE 7860

HEALTHCHECK --interval=60s --timeout=15s --start-period=30s --retries=3 \
    CMD curl -f http://localhost:7860/api/health || exit 1

# Start uvicorn, ensuring sys.path includes the root so `app.` imports work
CMD ["python", "-m", "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]