-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
92 lines (77 loc) · 3 KB
/
makefile
File metadata and controls
92 lines (77 loc) · 3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# Makefile
BUILD_VERSION ?= 0.3
# Define the version variables
PG_SEARCH_VERSION ?= 0.15.8
PG_VECTORSCALE_VERSION ?= 0.5.1
PGVECTOR_BASE_VERSION ?= 0.8.0
# Define PostgreSQL major versions to build for
PG_VERSIONS := 14 15 16 17
# Define the base image URL with PG_MAJOR_VERSION
define PG_VECTOR_BASE_VERSION
$(PGVECTOR_BASE_VERSION)-pg$(version)
endef
# --------------------------- Docker Build Tags ---------------------------
# Define the build tag, default to 0.1-pg{PG_MAJOR_VERSION}
define BUILD_TAG
$(BUILD_VERSION)-pg$(version)
endef
define LATEST_TAG
latest-pg$(version)
endef
# ---------------------------- Dependency URLs ----------------------------
# Define the URLs for the deb files with version variables and PG_MAJOR_VERSION
define PG_SEARCH_URL
"https://github.com/paradedb/paradedb/releases/download/v$(PG_SEARCH_VERSION)/postgresql-$(version)-pg-search_$(PG_SEARCH_VERSION)-1PARADEDB-bookworm_amd64.deb"
endef
define PGVECTORSCALE_ZIP_URL
"https://github.com/timescale/pgvectorscale/releases/download/$(PG_VECTORSCALE_VERSION)/pgvectorscale-$(PG_VECTORSCALE_VERSION)-pg$(version)-amd64.zip"
endef
# ------------------------------ Local Paths ------------------------------
# Define the local paths for the deb files
PG_SEARCH_DEB := pg_search.deb
PGVECTORSCALE_DEB := pgvectorscale.deb
# Download the deb files
.PHONY: download
download: $(PG_SEARCH_DEB) $(PGVECTORSCALE_DEB)
$(PG_SEARCH_DEB):
$(foreach version,$(PG_VERSIONS), \
echo "Downloading pg_search.deb for PostgreSQL $(version) from $(PG_SEARCH_URL)"; \
curl -L $(PG_SEARCH_URL) -o $(PG_SEARCH_DEB); \
)
$(PGVECTORSCALE_DEB):
$(foreach version,$(PG_VERSIONS), \
echo "Downloading pgvectorscale.zip for PostgreSQL $(version) from $(PGVECTORSCALE_ZIP_URL)"; \
curl -L $(PGVECTORSCALE_ZIP_URL) -o pgvectorscale.zip; \
unzip -j pgvectorscale.zip "pgvectorscale-postgresql-$(version)_$(PG_VECTORSCALE_VERSION)-Linux_amd64.deb" -d .; \
mv pgvectorscale-postgresql-$(version)_$(PG_VECTORSCALE_VERSION)-Linux_amd64.deb $(PGVECTORSCALE_DEB); \
rm -f pgvectorscale.zip; \
)
# Build the Docker image
.PHONY: build
build: download
$(foreach version,$(PG_VERSIONS), \
echo "Building Docker image for PostgreSQL $(version)"; \
docker build --build-arg PG_VECTOR_BASE_VERSION=$(PG_VECTOR_BASE_VERSION) -t oaklight/vectorsearch:$(BUILD_TAG) .; \
docker tag oaklight/vectorsearch:$(BUILD_TAG) oaklight/vectorsearch:$(LATEST_TAG); \
)
# Clean up the deb files
.PHONY: clean
clean:
echo "Cleaning up deb files"
rm -f $(PG_SEARCH_DEB) $(PGVECTORSCALE_DEB)
# Prune Docker images
.PHONY: prune
prune: clean
$(foreach version,$(PG_VERSIONS), \
echo "Pruning Docker images for PostgreSQL $(version)"; \
docker rmi oaklight/vectorsearch:$(BUILD_TAG); \
docker rmi oaklight/vectorsearch:$(LATEST_TAG); \
)
# Push Docker images to Docker Hub
.PHONY: push
push: build
$(foreach version,$(PG_VERSIONS), \
echo "Pushing Docker images for PostgreSQL $(version)"; \
docker push oaklight/vectorsearch:$(BUILD_TAG); \
docker push oaklight/vectorsearch:$(LATEST_TAG); \
)