Skip to content

Commit

Permalink
fix image build (#136)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChuckHend authored Aug 23, 2024
1 parent 65e1569 commit 8c527c2
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 43 deletions.
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
target
**/target/
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ pg_vectorize powers the [VectorDB Stack](https://tembo.io/docs/product/stacks/ai
- [Vector Search Example](#vector-search-example)
- [RAG Example](#rag-example)
- [Updating Embeddings](#updating-embeddings)
- [Directly Interact with LLMs](#directly-interact-with-llms)

## Installation

Expand Down
7 changes: 3 additions & 4 deletions extension/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@ DISTNAME = $(shell grep -m 1 '^name' Trunk.toml | sed -e 's/[^"]*"\([^"]*\)",\{0
DISTVERSION = $(shell grep -m 1 '^version' Trunk.toml | sed -e 's/[^"]*"\([^"]*\)",\{0,1\}/\1/')
PG_VERSION:=16
DATABASE_URL:=postgres://${USER}:${USER}@localhost:288${PG_VERSION}/postgres
PGRX_PG_CONFIG =$(shell cargo pgrx info pg-config pg${PG_VERSION})
PGRX_PG_CONFIG:=$(shell cargo pgrx info pg-config pg${PG_VERSION})
UPGRADE_FROM_VER:=0.16.0
BRANCH:=$(git rev-parse --abbrev-ref HEAD)
RUST_LOG:=debug
ARCH := $(shell uname -m)


.PHONY: install-pg_cron install-pg_vector install-pgmq run setup test-integration test-unit test-version test-branch test-upgrade cat-logs docs

sqlx-cache:
Expand Down Expand Up @@ -58,13 +57,12 @@ install-pg_cron:
git clone https://github.com/citusdata/pg_cron.git && \
cd pg_cron && \
sed -i.bak 's/-Werror//g' Makefile && \
PG_CONFIG=${PGRX_PG_CONFIG} make clean && \
PG_CONFIG=${PGRX_PG_CONFIG} make && \
PG_CONFIG=${PGRX_PG_CONFIG} make install && \
cd .. && rm -rf pg_cron

install-pgvector:
git clone --branch v0.6.0 https://github.com/pgvector/pgvector.git && \
git clone https://github.com/pgvector/pgvector.git && \
cd pgvector && \
PG_CONFIG=${PGRX_PG_CONFIG} make clean && \
PG_CONFIG=${PGRX_PG_CONFIG} make && \
Expand All @@ -75,6 +73,7 @@ install-pgmq:
git clone https://github.com/tembo-io/pgmq.git && \
cd pgmq/pgmq-extension && \
PG_CONFIG=${PGRX_PG_CONFIG} make && \
PG_CONFIG=${PGRX_PG_CONFIG} make clean && \
PG_CONFIG=${PGRX_PG_CONFIG} make install && \
cd .. && rm -rf pgmq

Expand Down
44 changes: 7 additions & 37 deletions images/vectorize-pg/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
ARG PG_MAJ=16
FROM postgres:$PG_MAJ-bookworm as builder

ARG VECTOR_VER=0.7.1
ARG VSCALE_VER=0.2.0
ARG CRON_VER=1.6.2
ARG VECTOR_VER=0.7.4
ARG VSCALE_VER=0.3.0
ARG CRON_VER=1.6.4
ARG PGRX_VER=0.11.3
ARG PG_MAJ=16

Expand All @@ -21,27 +21,6 @@ RUN apt-get update \

WORKDIR /vectorize

# install pgvector
RUN git clone https://github.com/pgvector/pgvector.git && \
cd pgvector && \
git fetch origin v$VECTOR_VER && \
git checkout v$VECTOR_VER && \
make && make install && \
cd .. && rm -rf pgvector

# install pg_cron
RUN git clone https://github.com/citusdata/pg_cron.git --branch v$CRON_VER && \
cd pg_cron && \
make && make install && \
cd .. && rm -rf pg_cron

# install pgmq
RUN git clone https://github.com/tembo-io/pgmq.git && \
cd pgmq/extension && \
make && \
make install && \
cd ../.. && rm -rf pgmq

# Install Rust dependencies
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
RUN $HOME/.cargo/bin/rustup default stable
Expand All @@ -54,22 +33,13 @@ RUN $HOME/.cargo/bin/cargo pgrx init --pg$PG_MAJ $(which pg_config)
ARG PG_MAJ=16
RUN $HOME/.cargo/bin/cargo pgrx init --pg${PG_MAJ} /usr/bin/pg_config

# install vectorscale
ARG TARGETARCH
RUN if [ "$TARGETARCH" = "amd64" ]; then \
export RUSTFLAGS="-C target-feature=+avx2,+fma"; \
fi
COPY . .

RUN git clone https://github.com/timescale/pgvectorscale.git && \
cd pgvectorscale/pgvectorscale && \
git fetch origin $VSCALE_VER && \
git checkout $VSCALE_VER && \
sed -i '/blas/d' Cargo.toml && \
sed -i '/blas_src/d' src/access_method/mod.rs && \
$HOME/.cargo/bin/cargo pgrx install --pg-config=$(which pg_config)
# install dependencies
ARG PG_MAJ=16
RUN export PATH="${HOME}/.cargo/bin:$PATH" && cd extension && make setup.dependencies PGRX_PG_CONFIG=$(cargo pgrx info pg-config pg${PG_MAJ})

# install pg-vectorize
COPY . .
RUN cd extension && \
$HOME/.cargo/bin/cargo pgrx install --pg-config=$(which pg_config)

Expand Down
2 changes: 1 addition & 1 deletion images/vectorize-pg/postgresql.conf
Original file line number Diff line number Diff line change
Expand Up @@ -816,5 +816,5 @@ pg_stat_statements.track = all # Track statements generated by stored pr
# Add settings for extensions here
shared_preload_libraries = 'vectorize,pg_cron'
cron.database_name = 'postgres'
vectorize.embedding_service_url = 'http://vector-serve:3000/v1/embeddings'
vectorize.embedding_service_url = 'http://vector-serve:3000/v1'
vectorize.ollama_service_url = 'http://ollama-serve:3001/v1/chat'

0 comments on commit 8c527c2

Please sign in to comment.