Skip to content

Commit

Permalink
Add PG_MAJOR_VERSION variable (#256)
Browse files Browse the repository at this point in the history
  • Loading branch information
jgpruitt authored Jun 13, 2024
1 parent 5410025 commit 0251f76
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
Expand Down Expand Up @@ -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) \
Expand All @@ -50,18 +52,19 @@ 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) .
touch .multi_$(TS_VERSION)_$(PG_VER)
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)
Expand Down

0 comments on commit 0251f76

Please sign in to comment.