Skip to content

Commit

Permalink
Merge pull request #252 from qiangxuhui/main
Browse files Browse the repository at this point in the history
add pgvector 0.5.0
  • Loading branch information
qiangxuhui authored Jul 15, 2024
2 parents 6fdb732 + 44c65a4 commit 5b9c1a2
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 0 deletions.
1 change: 1 addition & 0 deletions pgvector/pgvector/0.5.0/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
src
42 changes: 42 additions & 0 deletions pgvector/pgvector/0.5.0/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# This file is generated by the template.

REGISTRY?=cr.loongnix.cn
ORGANIZATION?=pgvector
REPOSITORY?=pgvector
TAG?=v0.5.0
LATEST?=true

IMAGE=$(REGISTRY)/$(ORGANIZATION)/$(REPOSITORY):$(TAG)
LATEST_IMAGE=$(REGISTRY)/$(ORGANIZATION)/$(REPOSITORY):latest

# SOURCE_URL is a url to download source, such as https://github.com/merore/merore.git.
# SOURCE is project sources, its located at src/$(SORUCE).
# PATCH is a patch that supports loong64 to $(SOURCE).
# Be sure to fill in the follows!!!
SOURCE_URL=https://github.com/pgvector/pgvector.git
SOURCE=$(shell echo $(SOURCE_URL) | awk -F '/' '{print $$NF}' | awk -F '.' '{print $$1}')
PATCH=loong64.patch

default: image

image: src/$(SOURCE)
# Commands for building.
cd src/$(SOURCE) && \
docker build -f Dockerfile.loongarch64 -t cr.loongnix.cn/pgvector/pgvector:0.5.0 . && \
cd ../..

src/$(SOURCE):
git clone -q -b $(TAG) --depth=1 $(SOURCE_URL) $@
cd $@ && \
git apply ../../$(PATCH)

push:
docker push $(IMAGE)
@if [ $(LATEST) = "true" ]; \
then\
docker tag $(IMAGE) $(LATEST_IMAGE); \
docker push $(LATEST_IMAGE); \
fi

clean:
rm -rf src
22 changes: 22 additions & 0 deletions pgvector/pgvector/0.5.0/loong64.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
diff --git a/Dockerfile.loongarch64 b/Dockerfile.loongarch64
new file mode 100644
index 0000000..29309ed
--- /dev/null
+++ b/Dockerfile.loongarch64
@@ -0,0 +1,16 @@
+ARG PG_MAJOR=15
+FROM cr.loongnix.cn/library/postgres:15-alpine
+ARG PG_MAJOR
+
+COPY . /tmp/pgvector
+
+RUN cd /tmp/pgvector && \
+ apk add --no-cache --virtual .build-postgres-cache build-base && \
+ make clean && \
+ make OPTFLAGS="" && \
+ make install && \
+ mkdir -p /usr/share/doc/pgvector && \
+ cp LICENSE README.md /usr/share/doc/pgvector && \
+ rm -r /tmp/pgvector && \
+ apk del --no-network .build-postgres-cache
+

0 comments on commit 5b9c1a2

Please sign in to comment.