From 0251f7621bc20694e5a6821e17328021061d617a Mon Sep 17 00:00:00 2001 From: John Pruitt Date: Thu, 13 Jun 2024 10:13:38 -0500 Subject: [PATCH] Add PG_MAJOR_VERSION variable (#256) --- Dockerfile | 3 ++- Makefile | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9735051..388c0e8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -34,8 +34,9 @@ LABEL maintainer="Timescale https://www.timescale.com" # install pgai only on pg16+ ARG PGAI_VERSION +ARG PG_MAJOR_VERSION RUN set -ex; \ - if [ "$PG_VERSION" -gt 15 ]; then \ + if [ "$PG_MAJOR_VERSION" -gt 15 ]; then \ apk update; \ apk add --no-cache --virtual .pgai-deps \ git \ diff --git a/Makefile b/Makefile index 6b64561..fb0a6a3 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,7 @@ NAME=timescaledb ORG=timescaledev PG_VER=pg16 PG_VER_NUMBER=$(shell echo $(PG_VER) | cut -c3-) +PG_MAJOR_VERSION=$(shell echo $(PG_VER_NUMBER) | cut -d. -f1) TS_VERSION=main PREV_TS_VERSION=$(shell wget --quiet -O - https://raw.githubusercontent.com/timescale/timescaledb/${TS_VERSION}/version.config | grep update_from_version | sed -e 's!update_from_version = !!') PREV_TS_IMAGE="timescale/timescaledb:$(PREV_TS_VERSION)-pg$(PG_VER_NUMBER)$(PREV_EXTRA)" @@ -32,6 +33,7 @@ default: image docker buildx build --platform $(PLATFORM) \ --build-arg TS_VERSION=$(TS_VERSION) \ --build-arg PG_VERSION=$(PG_VER_NUMBER) \ + --build-arg PG_MAJOR_VERSION=$(PG_MAJOR_VERSION) \ --build-arg PREV_IMAGE=$(PREV_IMAGE) \ --build-arg OSS_ONLY=" -DAPACHE_ONLY=1" \ --build-arg PGVECTOR_VERSION=$(PGVECTOR_VERSION) \ @@ -50,6 +52,7 @@ default: image --build-arg TS_VERSION=$(TS_VERSION) \ --build-arg PREV_IMAGE=$(PREV_IMAGE) \ --build-arg PG_VERSION=$(PG_VER_NUMBER) \ + --build-arg PG_MAJOR_VERSION=$(PG_MAJOR_VERSION) \ --build-arg PGVECTOR_VERSION=$(PGVECTOR_VERSION) \ --build-arg PGAI_VERSION=$(PGAI_VERSION) \ $(TAG) $(PUSH_MULTI) . @@ -57,11 +60,11 @@ default: image docker buildx rm multibuild .build_$(TS_VERSION)_$(PG_VER)_oss: Dockerfile - docker build --build-arg OSS_ONLY=" -DAPACHE_ONLY=1" --build-arg PG_VERSION=$(PG_VER_NUMBER) --build-arg PGVECTOR_VERSION=$(PGVECTOR_VERSION) --build-arg PGAI_VERSION=$(PGAI_VERSION) $(TAG_OSS) . + docker build --build-arg OSS_ONLY=" -DAPACHE_ONLY=1" --build-arg PG_VERSION=$(PG_VER_NUMBER) --build-arg PG_MAJOR_VERSION=$(PG_MAJOR_VERSION) --build-arg PGVECTOR_VERSION=$(PGVECTOR_VERSION) --build-arg PGAI_VERSION=$(PGAI_VERSION) $(TAG_OSS) . touch .build_$(TS_VERSION)_$(PG_VER)_oss .build_$(TS_VERSION)_$(PG_VER): Dockerfile - docker build --build-arg PG_VERSION=$(PG_VER_NUMBER) --build-arg TS_VERSION=$(TS_VERSION) --build-arg PREV_IMAGE=$(PREV_IMAGE) --build-arg PGVECTOR_VERSION=$(PGVECTOR_VERSION) --build-arg PGAI_VERSION=$(PGAI_VERSION) $(TAG) . + docker build --build-arg PG_VERSION=$(PG_VER_NUMBER) --build-arg PG_MAJOR_VERSION=$(PG_MAJOR_VERSION) --build-arg TS_VERSION=$(TS_VERSION) --build-arg PREV_IMAGE=$(PREV_IMAGE) --build-arg PGVECTOR_VERSION=$(PGVECTOR_VERSION) --build-arg PGAI_VERSION=$(PGAI_VERSION) $(TAG) . touch .build_$(TS_VERSION)_$(PG_VER) image: .build_$(TS_VERSION)_$(PG_VER)