Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
53 lines (49 loc) · 1.51 KB
/
Copy pathDockerfile
File metadata and controls
53 lines (49 loc) · 1.51 KB
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
# syntax=docker/dockerfile:1
ARG POSTGRES_VERSION=17-bookworm
FROM postgres:${POSTGRES_VERSION}
ARG PGVECTOR_VERSION
ADD https://github.com/pgvector/pgvector.git#v${PGVECTOR_VERSION} /tmp/pgvector
RUN set -eux; \
if command -v apt-get >/dev/null 2>&1; then \
apt-get update; \
apt-mark hold locales; \
apt-get install -y --no-install-recommends \
build-essential \
"postgresql-server-dev-${PG_MAJOR}"; \
cd /tmp/pgvector; \
make clean; \
make OPTFLAGS=""; \
make install; \
mkdir -p /usr/share/doc/pgvector; \
cp LICENSE README.md /usr/share/doc/pgvector/; \
cd /; \
rm -rf /tmp/pgvector; \
apt-get purge -y --auto-remove \
build-essential \
"postgresql-server-dev-${PG_MAJOR}"; \
apt-mark unhold locales; \
rm -rf /var/lib/apt/lists/*; \
elif command -v apk >/dev/null 2>&1; then \
llvm_major="$(pg_config --configure | sed -n \
's#.*LLVM_CONFIG=/usr/lib/llvm\([0-9][0-9]*\)/bin/llvm-config.*#\1#p')"; \
if [ -n "${llvm_major}" ]; then \
apk add --no-cache --virtual .pgvector-build-deps \
build-base \
"clang${llvm_major}" \
"llvm${llvm_major}-dev"; \
else \
apk add --no-cache --virtual .pgvector-build-deps build-base; \
fi; \
cd /tmp/pgvector; \
make clean; \
make OPTFLAGS=""; \
make install; \
mkdir -p /usr/share/doc/pgvector; \
cp LICENSE README.md /usr/share/doc/pgvector/; \
cd /; \
rm -rf /tmp/pgvector; \
apk del .pgvector-build-deps; \
else \
echo >&2 "unsupported postgres base image: apt-get or apk is required"; \
exit 1; \
fi