File size: 755 Bytes
4b95d23
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Use Python 3.12 as recommended
FROM python:3.12-slim

# Install LaTeX (optional but recommended if compile_latex=true)
RUN apt-get update && \
    apt-get install -y --no-install-recommends texlive-latex-extra && \
    rm -rf /var/lib/apt/lists/*

# Create non-root user
RUN useradd -m -u 1000 user
USER user
ENV PATH="/home/user/.local/bin:$PATH"

WORKDIR /app

# Install Python deps
COPY --chown=user ./requirements.txt requirements.txt
RUN pip install --no-cache-dir --upgrade -r requirements.txt

# Install uvicorn for FastAPI
RUN pip install --no-cache-dir uvicorn fastapi pydantic

# Copy app code
COPY --chown=user . /app

# Expose default HF port
EXPOSE 7860

# Start FastAPI app
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]