Spaces:
Sleeping
Sleeping
Commit
·
d33651f
1
Parent(s):
4649521
feat: add pgvector and database dump
Browse files- Dockerfile +21 -4
- docker-entrypoint-initdb.d/01-restore.sh +7 -0
Dockerfile
CHANGED
@@ -3,11 +3,14 @@ FROM postgres:14.3
|
|
3 |
WORKDIR /app
|
4 |
|
5 |
RUN apt update && \
|
6 |
-
apt install -y \
|
|
|
7 |
python3 \
|
8 |
python3-pip \
|
|
|
9 |
libpq-dev \
|
10 |
-
htop
|
|
|
11 |
|
12 |
COPY ./ /app/
|
13 |
|
@@ -15,12 +18,26 @@ RUN pip3 install -r ./requirements.txt
|
|
15 |
|
16 |
EXPOSE 7860
|
17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
COPY "execution.sh" "/usr/local/bin/"
|
19 |
|
20 |
-
|
21 |
|
22 |
-
|
23 |
|
24 |
STOPSIGNAL SIGINT
|
25 |
|
|
|
|
|
26 |
CMD ["postgres"]
|
|
|
3 |
WORKDIR /app
|
4 |
|
5 |
RUN apt update && \
|
6 |
+
apt install -y --no-install-recommends \
|
7 |
+
build-essential \
|
8 |
python3 \
|
9 |
python3-pip \
|
10 |
+
postgresql-server-dev-14 \
|
11 |
libpq-dev \
|
12 |
+
htop \
|
13 |
+
git
|
14 |
|
15 |
COPY ./ /app/
|
16 |
|
|
|
18 |
|
19 |
EXPOSE 7860
|
20 |
|
21 |
+
ENV POSTGRES_USER=postgres
|
22 |
+
ENV POSTGRES_PASSWORD=pwd
|
23 |
+
ENV POSTGRES_PASSWORD=sorbobot
|
24 |
+
|
25 |
+
# Install PGVector
|
26 |
+
WORKDIR /tmp
|
27 |
+
RUN git clone --branch v0.5.1 https://github.com/pgvector/pgvector.git
|
28 |
+
WORKDIR /tmp/pgvector
|
29 |
+
RUN make
|
30 |
+
RUN make install # may need sudo
|
31 |
+
WORKDIR /app
|
32 |
+
|
33 |
COPY "execution.sh" "/usr/local/bin/"
|
34 |
|
35 |
+
COPY ./docker-entrypoint-initdb.d/ /docker-entrypoint-initdb.d/
|
36 |
|
37 |
+
ENTRYPOINT ["execution.sh"]
|
38 |
|
39 |
STOPSIGNAL SIGINT
|
40 |
|
41 |
+
HEALTHCHECK CMD curl --fail http://localhost:7860/_stcore/health
|
42 |
+
|
43 |
CMD ["postgres"]
|
docker-entrypoint-initdb.d/01-restore.sh
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/bash
|
2 |
+
|
3 |
+
file="/docker-entrypoint-initdb.d/dump.pgdata"
|
4 |
+
dbname=sorbobot
|
5 |
+
|
6 |
+
echo "Restoring DB using $file"
|
7 |
+
pg_restore -U postgres --dbname=$dbname --verbose --single-transaction < "$file" || exit 1
|