diff --git a/pgvector/pgvector/0.5.0/.gitignore b/pgvector/pgvector/0.5.0/.gitignore new file mode 100644 index 00000000..85de9cf9 --- /dev/null +++ b/pgvector/pgvector/0.5.0/.gitignore @@ -0,0 +1 @@ +src diff --git a/pgvector/pgvector/0.5.0/Makefile b/pgvector/pgvector/0.5.0/Makefile new file mode 100644 index 00000000..2cb65af5 --- /dev/null +++ b/pgvector/pgvector/0.5.0/Makefile @@ -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 diff --git a/pgvector/pgvector/0.5.0/loong64.patch b/pgvector/pgvector/0.5.0/loong64.patch new file mode 100644 index 00000000..87ec48e1 --- /dev/null +++ b/pgvector/pgvector/0.5.0/loong64.patch @@ -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 ++