Add Postgresql from Official container image with pgvector

This commit is contained in:
Fabiano Martins 2025-02-02 01:01:01 -03:00 committed by Gabriel Rodrigues
parent 2642b001d1
commit 042c7949b4

37
.postgres/Dockerfile Normal file
View File

@ -0,0 +1,37 @@
FROM golang:1.23.4-alpine3.21 AS go_build
WORKDIR /build
RUN apk update \
&& apk add --no-cache \
build-base \
git
RUN git clone https://github.com/tianon/gosu.git .
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build \
-ldflags="-s -w" \
-o gosu
FROM postgres:16-alpine3.21 AS pgvector_build
WORKDIR /pgvector
RUN apk update \
&& apk add --no-cache \
build-base \
git \
clang \
llvm \
postgresql16-dev
RUN git clone https://github.com/pgvector/pgvector.git . \
&& make \
&& make install
FROM postgres:16-alpine3.21
COPY --from=go_build /build/gosu /usr/local/bin
COPY --from=pgvector_build /pgvector/vector.so /usr/local/lib/postgresql
COPY --from=pgvector_build /pgvector/vector.control /usr/local/share/postgresql/extension
COPY --from=pgvector_build /pgvector/sql/vector--0.8.0.sql /usr/local/share/postgresql/extension