File size: 1,019 Bytes
74cf6bd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ad97a86
74cf6bd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
40
41
FROM python:3.10-slim

# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
    curl \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /app

# Install Poetry
RUN pip install poetry==1.8.3

# Copy poetry configuration files
COPY pyproject.toml poetry.lock poetry.toml* ./

# Configure poetry to not create a virtual environment
RUN poetry config virtualenvs.create false

# Install dependencies
RUN poetry install --no-dev --no-interaction --no-ansi

# Copy application code
COPY app ./app

# Expose port
EXPOSE 7860

# Set environment variables
ENV PYTHONPATH=/app
ENV QDRANT_URL=http://localhost:6333
# ENV QDRANT_API_KEY=your_api_key_here (uncomment and set if needed)

# Calculate the number of workers based on available CPUs
# Using the recommended formula: (2 * CPU cores) + 1
ENV WORKERS=4

# Create gunicorn config file
COPY gunicorn.conf.py ./

# Command to run the application with Gunicorn and Uvicorn workers
CMD ["gunicorn", "app.main:app", "-c", "gunicorn.conf.py"]