File size: 739 Bytes
65952f6
 
f42f941
65952f6
33c584f
06eacd3
65952f6
8f110eb
74de35c
65952f6
fd4e818
 
65952f6
f45e402
 
65952f6
f45e402
7eb3110
8f110eb
 
 
 
 
 
 
88284a4
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
# Instead of FROM python:3.12, use a slim base image
FROM python:3.12-slim

# Set the working directory
WORKDIR /app

# Copy requirements.txt (llama-cpp-python is already included in the base image)
COPY ./requirements.txt /app/requirements.txt

# Install only project-specific dependencies
RUN pip install --no-cache-dir -r requirements.txt

# Copy the entire application source code
COPY . /app

# Expose port for Hugging Face Spaces
EXPOSE 7860

# Run FastAPI with Gunicorn - increased timeout for model loading
CMD ["gunicorn", "app.main:app", \
    "-k", "uvicorn.workers.UvicornWorker", \
    "--bind", "0.0.0.0:7860", \
    "--workers", "1", \
    "--timeout", "600", \
    "--graceful-timeout", "600", \
    "--log-level", "info"]