-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathDockerfile
153 lines (129 loc) · 4.56 KB
/
Dockerfile
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
#FROM debian:bullseye-slim
FROM gcc:12.3.0
# make the "en_US.UTF-8" locale so postgres will be utf-8 enabled by default
ENV LANG en_US.utf8
ENV PG_MAJOR 13
ENV PG_VERSION 13.4
ENV PGDATA /u02/pgdata
ENV PGDATABASE "" \
PGUSERNAME "" \
PGPASSWORD ""
ARG UID=999
ARG GID=999
ENV PG_INSTALL_DIR /u01/app/postgres/product/${PG_VERSION}
RUN set -ex \
\
&& apt-get update && apt-get install -y \
gettext \
ca-certificates \
build-essential \
curl \
procps \
sysstat \
libldap2-dev \
python3-dev \
libreadline-dev \
libssl-dev \
bison \
flex \
libghc-zlib-dev \
libcrypto++-dev \
libxml2-dev \
libxslt1-dev \
bzip2 \
make \
gcc \
unzip \
python3 \
locales \
wget \
\
# && rm -rf /var/lib/apt/lists/* \
&& localedef -i en_US -c -f UTF-8 en_US.UTF-8
RUN apt-get update && \
apt-get install -y --no-install-recommends wget git golang-go swig vim\
libboost-filesystem-dev libboost-test-dev libboost-serialization-dev libboost-regex-dev libboost-serialization-dev libboost-regex-dev libboost-thread-dev libboost-system-dev
RUN wget "https://boostorg.jfrog.io/artifactory/main/release/1.81.0/source/boost_1_81_0.tar.gz" --no-check-certificate -q -O - \
| tar -xz && \
cd boost_1_81_0 && \
./bootstrap.sh && \
./b2 install && \
ldconfig && \
cd .. && rm -rf boost_1_81_0
RUN wget "https://github.com/Kitware/CMake/releases/download/v3.14.4/cmake-3.14.4-Linux-x86_64.tar.gz" --no-check-certificate -q -O - \
| tar -xz --strip-components=1 -C /usr/local
#RUN apt-get install -y software-properties-common && add-apt-repository 'deb http://archive.debian.org/debian stretch stretch-security main contrib non-free' && apt-get update && apt-get install -y openjdk-8-jdk
#RUN apt install -y pip && pip install numpy && pip install pandas
RUN git config --global http.sslverify false
#RUN wget http://ftp.gnu.org/gnu/gcc/gcc-12.2.0/gcc-12.2.0.tar.gz \
# && tar -zxvf gcc-12.2.0.tar.gz \
# && cd gcc-12.2.0 \
# && ./contrib/download_prerequisites \
# && mkdir build \
# && cd build/ \
# && ../configure -enable-checking=release -enable-languages=c,c++ -disable-multilib \
# && make -j4 \
# && make install \
# && rm /usr/bin/gcc \
# && ln -s /usr/local/bin/gcc /usr/bin/gcc \
# && rm /usr/bin/g++ \
# && ln -s /usr/local/bin/g++ /usr/bin/g++ \
# && rm /usr/lib/x86_64-linux-gnu/libstdc++.so.6 \
# && ln -s /usr/local/lib64/libstdc++.so.6.0.30 /usr/lib/x86_64-linux-gnu/libstdc++.so.6
RUN mkdir /u01/ \
\
&& groupadd -r postgres --gid=$GID \
&& useradd -m -r -g postgres --uid=$UID postgres \
&& chown postgres:postgres /u01/ \
&& mkdir -p "$PGDATA" \
&& chown -R postgres:postgres "$PGDATA" \
&& chmod 700 "$PGDATA"
COPY ./thirdparty/Postgres /home/postgres/src/
RUN echo "this line could be executed for a very long time" && chown -R postgres:postgres /home/postgres/src
RUN cd /home/postgres/src \
&& su postgres -c "./configure \
--with-blocksize=32 \
--enable-integer-datetimes \
--enable-thread-safety \
--with-pgport=5432 \
--prefix=$PG_INSTALL_DIR \
--with-ldap \
--with-python \
--with-openssl \
--with-libxml \
--with-libxslt \
--enable-nls=yes" \
# --enable-debug \
# --enable-cassert \
# CFLAGS='-ggdb -O0'" \
&& su postgres -c "make -j$(nproc) all" \
&& su postgres -c "make install" \
&& su postgres -c "make -C contrib install" \
&& apt-get install -y libxml2
ENV PGDATA ${PGDATA}/${PG_MAJOR}
COPY ./scripts/pg_scripts/*.sh /usr/local/bin/
ENV PATH="${PATH}:${PG_INSTALL_DIR}/bin"
ENV LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${PG_INSTALL_DIR}/lib"
COPY . /tmp/vectordb
RUN chown -R postgres:postgres /tmp/vectordb
ENV PostgreSQL_ROOT ${PG_INSTALL_DIR}
RUN cd /tmp/vectordb && \
mkdir build && \
cd build && \
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/vectordb -DLIBRARYONLY=ON -DSEEK_ENABLE_TESTS=ON -DCMAKE_BUILD_TYPE=Release .. && \
make -j$(nproc) && \
make install
# the followings two commands install an http-client library called curlpp
#RUN apt-get update && apt-get install -y libcurl4-openssl-dev pkg-config
#RUN git clone https://github.com/jpbarrette/curlpp.git && cd curlpp && \
# git reset --hard 592552a && \
# mkdir build && cd build && \
# cmake .. && make -j$(nproc) && \
# make install
ENV PATH="${PATH}:/usr/local/lib"
ENV LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/usr/local/lib"
ENV LANG en_US.utf8
USER postgres
EXPOSE 5432
ENTRYPOINT ["docker-entrypoint.sh"]
#ENTRYPOINT ["sleep","infinity"]