File size: 1,279 Bytes
3a1960e
 
ab34076
 
 
 
 
 
 
 
 
 
 
 
 
 
d1b96b3
 
 
 
 
ab34076
 
d1b96b3
 
 
 
 
 
 
 
 
 
 
 
 
ab34076
eb6ffad
ab34076
d1b96b3
 
 
ab34076
3a1960e
d1b96b3
ab34076
 
 
 
a515aee
 
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
42
43
44
45
46
47
48
49
50
51
52
FROM python:3.9

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

# Set working directory
WORKDIR /app

# Copy and install Python dependencies
COPY --chown=user ./requirements.txt requirements.txt
RUN pip install --no-cache-dir --upgrade -r requirements.txt

# Install system dependencies and build tools
USER root
RUN apt-get update && apt-get install -y \
    python3 \
    python3-pip \
    python3-venv \
    wget \
    build-essential \
    libsqlite3-dev

# Install newer SQLite version
WORKDIR /tmp
RUN wget https://www.sqlite.org/2023/sqlite-autoconf-3410200.tar.gz \
    && tar -xvf sqlite-autoconf-3410200.tar.gz \
    && cd sqlite-autoconf-3410200 \
    && ./configure \
    && make \
    && make install

# Update library path to use the new SQLite
ENV LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH

RUN mkdir -p /app/static/chroma_store && chown -R user:user /app/static/chroma_store

# Go back to non-root user and app directory
USER user
WORKDIR /app

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

# Expose port 7860 for the application
EXPOSE 7860

# Start the app using waitress
CMD ["python", "-m", "waitress", "--listen=0.0.0.0:7860", "app:app"]
# python -m waitress --listen=0.0.0.0:7860 app:app