File size: 1,027 Bytes
68a9b68
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
53
54
55
56
57
FROM postgres:14.9-bookworm

WORKDIR /app

RUN apt update && \
    apt install -y --no-install-recommends \
    build-essential \
    python3 \
    python3-pip \
    python3-dev \
    postgresql-server-dev-14 \
    libpq-dev \
    libblas-dev \
    htop \
    git

COPY ./ /app/

RUN pip3 install -r ./requirements.txt --break-system-packages

EXPOSE 5432
EXPOSE 7860

ENV POSTGRES_USER=postgres
ENV POSTGRES_PASSWORD=pwd
ENV POSTGRES_DB=sorbobot

# User
RUN useradd -m -u 1000 user
ENV HOME /home/user
ENV PATH $HOME/.local/bin:$PATH

# Install PGVector
WORKDIR /tmp
RUN git clone --branch v0.5.1 https://github.com/pgvector/pgvector.git
WORKDIR /tmp/pgvector
RUN make
RUN make install # may need sudo
WORKDIR $HOME
COPY ./ $HOME

COPY "execution.sh" "/usr/local/bin/"

COPY ./docker-entrypoint-initdb.d/ /docker-entrypoint-initdb.d/

RUN chown -R user:user /var/lib/postgresql/data

USER user

ENTRYPOINT ["execution.sh"]

STOPSIGNAL SIGINT

HEALTHCHECK CMD curl --fail http://localhost:7860/_stcore/health

CMD ["postgres"]