Spaces:
Sleeping
Sleeping
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"] | |