Skip to content
← Back to activity

Immutable solution version

Is it possible to add pgvector extension on top of postgres:15.3-alpine images

Version 1Sign in to save

Complete solution

This extension of the Alpine docker image worked for me: `$ cat Dockerfile FROM postgres:16-alpine AS pgvector-builder RUN apk add git RUN apk add build-base RUN apk add clang RUN apk add llvm-dev WORKDIR /build RUN git clone --branch v0.8.0 https://github.com/pgvector/pgvector.git WORKDIR /build/pgvector RUN make RUN make install FROM postgres:16-alpine COPY --from=pgvector-builder /usr/local/lib/postgresql/bitcode/vector.index.bc /usr/local/lib/postgresql/bitcode/vector.index.bc COPY --from...

This extension of the Alpine docker image worked for me: $ cat Dockerfile FROM postgres:16-alpine AS pgvector-builder RUN apk add git RUN apk add build-base RUN apk add clang RUN apk add llvm-dev WORKDIR /build RUN git clone --branch v0.8.0 https://github.com/pgvector/pgvector.git WORKDIR /build/pgvector RUN make RUN make install FROM postgres:16-alpine COPY --from=pgvector-builder /usr/local/lib/postgresql/bitcode/vector.index.bc /usr/local/lib/postgresql/bitcode/vector.index.bc COPY --from=pgvector-builder /usr/local/lib/postgresql/vector.so /usr/local/lib/postgresql/vector.so COPY --from=pgvector-builder /usr/local/share/postgresql/extension /usr/local/share/postgresql/extension $ docker build -t postgres:16-alpine-pgvector .

Context: Stack Overflow #76571221 (accepted answer, 7 votes): I'm trying to dockerize pg-vector and I found this Dockerfile from the official repository. https://github.com/pgvector/pgvector/blob/master/Dockerfile#L2C1-L3C1 The Dockerfile currently uses postgres base image right now, I'm wondering if I can add the pgvector extension on top of the alpine images. If not, what are other possible options?

Evidence

Source: Stack Overflow #76571221 (accepted answer, 7 votes): I'm trying to dockerize pg-vector and I found this Dockerfile from the official repository. https://github.com/pgvector/pgvector/blob/master/Dockerfile#L2C1-L3C1 The Dockerfile currently uses postgres base image right now, I'm wondering if I can add the pgvector extension on top of the alpine images. If not, what are other possible options?

Verified resolution: This extension of the Alpine docker image worked for me: $ cat Dockerfile FROM postgres:16-alpine AS pgvector-builder RUN apk add git RUN apk add build-base RUN apk add clang RUN apk add llvm-dev WORKDIR /build RUN git clone --branch v0.8.0 https://github.com/pgvector/pgvector.git WORKDIR /build/pgvector RUN make RUN make install FROM postgres:16-alpine COPY --from=pgvector-builder /usr/local/lib/postgresql/bitcode/vector.index.bc /usr/local/lib/postgresql/bitcode/vector.index.bc COPY --from=pgvector-builder /usr/local/lib/postgresql/vector.so /usr/local/lib/postgresql/vector.so COPY --from=pgvector-builder /usr/local/share/postgresql/extension /usr/local/share/postgresql/extension $ docker build -t postgres:16-alpine-pgvector .

Source URL: https://stackoverflow.com/questions/76571221/is-it-possible-to-add-pgvector-extension-on-top-of-postgres15-3-alpine-images

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_0UHhgBi7HQynvPuriArRhQ" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Is it possible to add pgvector extension on top of postgres:15.3-alpine images <span>— Vectle</span></a>