File size: 793 Bytes
10757ec
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13802b3
10757ec
 
 
 
 
13802b3
10757ec
 
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
# Use Python 3.9 as the base image
FROM python:3.11-slim

# Set working directory
WORKDIR /app

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

# Create and activate virtual environment
ENV VIRTUAL_ENV=/opt/venv
RUN python3 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"

# Copy requirements first to leverage Docker cache
COPY requirements.txt /app/requirements.txt

# Install dependencies in virtual environment
RUN pip install --no-cache-dir --upgrade -r /app/requirements.txt
RUN pip install -qU chainlit

# Copy the rest of the application
COPY . .

# Expose the default Chainlit port
EXPOSE 7860

CMD ["chainlit", "run", "app.py", "--port", "7860"]