File tree Expand file tree Collapse file tree
docker-entrypoint-initdb.d Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- FROM pgvector/pgvector:pg16 AS builder
2-
31FROM postgres:16-alpine
42
5- COPY --from=builder /usr/lib/postgresql/16/lib/vector.so /usr/lib/postgresql/16/lib/vector.so
6- COPY --from=builder /usr/share/postgresql/16/extension/vector* /usr/lib/postgresql/16/share/extension/
3+ RUN apk update && apk add --no-cache \
4+ build-base \
5+ git \
6+ postgresql-dev \
7+ clang20 \
8+ llvm20-dev \
9+ llvm20-libs \
10+ llvm20-linker-tools
11+
12+ RUN ln -s "$(which clang)" /usr/bin/clang-19 \
13+ && ln -s "$(which clang++)" /usr/bin/clang++-19 \
14+ && mkdir -p /usr/lib/llvm19/bin \
15+ && ln -s /usr/bin/llvm-lto /usr/lib/llvm19/bin/llvm-lto
16+
17+ ENV CC=clang
18+
19+ RUN git clone --depth 1 https://github.com/pgvector/pgvector.git \
20+ && cd pgvector \
21+ && make \
22+ && make install \
23+ && cd .. \
24+ && rm -rf pgvector
25+
26+ COPY docker-entrypoint-initdb.d/01-create-vector.sh /docker-entrypoint-initdb.d/
27+ RUN chmod +x /docker-entrypoint-initdb.d/01-create-vector.sh
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ set -e
3+
4+ # create the extension in the default DB (usually $POSTGRES_DB or 'postgres')
5+ psql --username " $POSTGRES_USER " << -EOSQL
6+ CREATE EXTENSION IF NOT EXISTS vector WITH SCHEMA public;
7+ EOSQL
8+
9+ # also install into template1 so any newly created database inherits it
10+ psql --username " $POSTGRES_USER " --dbname=template1 << -EOSQL
11+ CREATE EXTENSION IF NOT EXISTS vector;
12+ EOSQL
You can’t perform that action at this time.
0 commit comments