Spaces:
Runtime error
Runtime error
Create Dockerfile
Browse files- Dockerfile +35 -0
Dockerfile
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM python:3.11-slim
|
2 |
+
|
3 |
+
# Set working directory
|
4 |
+
WORKDIR /app
|
5 |
+
|
6 |
+
# Install system dependencies
|
7 |
+
RUN apt-get update && \
|
8 |
+
apt-get install -y --no-install-recommends \
|
9 |
+
build-essential \
|
10 |
+
python3-dev \
|
11 |
+
&& rm -rf /var/lib/apt/lists/*
|
12 |
+
|
13 |
+
# Create and activate virtual environment
|
14 |
+
ENV VIRTUAL_ENV=/opt/venv
|
15 |
+
RUN python3 -m venv $VIRTUAL_ENV
|
16 |
+
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
|
17 |
+
|
18 |
+
# Copy requirements first to leverage Docker cache
|
19 |
+
COPY requirements.txt /app/requirements.txt
|
20 |
+
|
21 |
+
# Install dependencies in virtual environment
|
22 |
+
RUN pip install --no-cache-dir --upgrade -r /app/requirements.txt
|
23 |
+
|
24 |
+
# Copy the rest of the application
|
25 |
+
COPY . .
|
26 |
+
|
27 |
+
ENV PYTHONPATH=/app
|
28 |
+
ENV PYTHONUNBUFFERED=1
|
29 |
+
|
30 |
+
# Expose the default Chainlit port
|
31 |
+
EXPOSE 8000
|
32 |
+
|
33 |
+
# Command to run the application
|
34 |
+
# CMD . /opt/venv/bin/activate && exec chainlit run app.py --port 8000
|
35 |
+
CMD ["chainlit", "run", "app.py", "--port", "7860"]
|