From c98911520e96d7aa81189f0ab200386ddfd555a5 Mon Sep 17 00:00:00 2001 From: Anmol1696 Date: Thu, 16 Oct 2025 21:20:03 +0400 Subject: [PATCH 01/10] add new way to build and push docker images, cresate workflow to build and push docker image, add version for each of the docker --- .github/workflows/docker.yaml | 96 ++++++++++++++++++++++++++++++++ docker/Makefile | 98 ++++++++++++++++++++++++++++----- docker/node-sqitch/Dockerfile | 13 ++++- docker/node-sqitch/Makefile | 39 ------------- docker/node-sqitch/version.yaml | 3 + docker/pgvector/Dockerfile | 18 ++++-- docker/pgvector/Makefile | 35 ------------ docker/pgvector/version.yaml | 3 + docker/postgis/Dockerfile | 8 ++- docker/postgis/Makefile | 35 ------------ docker/postgis/version.yaml | 3 + 11 files changed, 217 insertions(+), 134 deletions(-) create mode 100644 .github/workflows/docker.yaml delete mode 100644 docker/node-sqitch/Makefile create mode 100644 docker/node-sqitch/version.yaml delete mode 100644 docker/pgvector/Makefile create mode 100644 docker/pgvector/version.yaml delete mode 100644 docker/postgis/Makefile create mode 100644 docker/postgis/version.yaml diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml new file mode 100644 index 000000000..3fd8c17cf --- /dev/null +++ b/.github/workflows/docker.yaml @@ -0,0 +1,96 @@ +name: Docker + +on: + push: + branches: + - main + - v1 + - release/* + paths: + - "docker/**" + - ".github/workflows/docker.yaml" + pull_request: + branches: + - main + - v1 + paths: + - "docker/**" + - ".github/workflows/docker.yaml" + types: [opened, reopened, synchronize, ready_for_review] + workflow_dispatch: + inputs: + process: + description: 'Process to build (pgvector | node-sqitch | postgis)' + type: choice + required: true + options: + - pgvector + - node-sqitch + - postgis + default: pgvector + version: + description: 'Specific version to build (must exist in version.yaml)' + type: string + required: true + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }}-docker + cancel-in-progress: true + +jobs: + build-push: + if: github.event_name != 'pull_request' || !github.event.pull_request.draft + runs-on: ubuntu-latest + + permissions: + contents: read + packages: write + + defaults: + run: + working-directory: docker + + strategy: + matrix: + process: [pgvector, node-sqitch, postgis] + max-parallel: 3 + + env: + REPO: ghcr.io/${{ github.repository_owner }} + PLATFORMS: linux/amd64,linux/arm64 + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to GHCR + if: github.event_name != 'pull_request' + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build (no push) + if: github.event_name == 'pull_request' + run: | + make \ + PROCESS=${{ matrix.process }} \ + REPO_NAME=$REPO \ + PLATFORMS="$PLATFORMS" \ + build-process + + - name: Build and push (all versions) + if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' + run: | + make \ + PROCESS=${{ matrix.process }} \ + REPO_NAME=$REPO \ + PLATFORMS="$PLATFORMS" \ + build-push-process diff --git a/docker/Makefile b/docker/Makefile index 54158c7e7..7671fcec7 100644 --- a/docker/Makefile +++ b/docker/Makefile @@ -1,20 +1,90 @@ -.PHONY: all push-all node-sqitch pgvector clean +.PHONY: all push-all build-all build-push-all build-process build-push-process \ + build-process-version build-push-process-version pgvector node-sqitch postgis clean -all: - $(MAKE) -C node-sqitch build - $(MAKE) -C pgvector build +REPO_NAME?=pyramation +PLATFORMS?=linux/arm64 -push-all: - $(MAKE) -C node-sqitch push - $(MAKE) -C pgvector push +# default process if none specified (can be overridden: `make PROCESS=postgis build-process`) +PROCESS?=pgvector -node-sqitch: - $(MAKE) -C node-sqitch build +# Convenience: list of known processes +PROCESSES:=pgvector node-sqitch postgis + +CONTAINER_NAME?=$(PROCESS) + +## build-process builds docker image(s) for $(PROCESS) using base+versions from version.yaml +## It will build one image per version listed in $(PROCESS)/version.yaml and tag as /: +build-process: + @echo "==> Building process: $(PROCESS)" + @BASE=$$(sed -n 's/^base:[[:space:]]*//p' $(PROCESS)/version.yaml | head -n1); \ + VERSIONS=$$(sed -n '/^versions:/,$$p' $(PROCESS)/version.yaml | sed -n 's/^-\s*//p'); \ + if [ -z "$$BASE" ] || [ -z "$$VERSIONS" ]; then \ + echo "Error: Could not parse base or versions from $(PROCESS)/version.yaml" 1>&2; \ + exit 1; \ + fi; \ + for v in $$VERSIONS; do \ + $(MAKE) --no-print-directory BASE=$$BASE VERSION=$$v build-process-version || exit $$?; \ + done + +build-all: + @for p in $(PROCESSES); do \ + $(MAKE) --no-print-directory PROCESS=$$p build-process || exit $$?; \ + done + +build-push-process: + @echo "==> Building+Pushing process: $(PROCESS)" + @BASE=$$(sed -n 's/^base:[[:space:]]*//p' $(PROCESS)/version.yaml | head -n1); \ + VERSIONS=$$(sed -n '/^versions:/,$$p' $(PROCESS)/version.yaml | sed -n 's/^-\s*//p'); \ + if [ -z "$$BASE" ] || [ -z "$$VERSIONS" ]; then \ + echo "Error: Could not parse base or versions from $(PROCESS)/version.yaml" 1>&2; \ + exit 1; \ + fi; \ + for v in $$VERSIONS; do \ + $(MAKE) --no-print-directory BASE=$$BASE VERSION=$$v build-push-process-version || exit $$?; \ + done + +build-push-all: + @for p in $(PROCESSES); do \ + $(MAKE) --no-print-directory PROCESS=$$p build-push-process || exit $$?; \ + done +# Build only a specific VERSION for $(PROCESS). Intended for internal use by build-process. +# Usage (internal): $(MAKE) BASE= VERSION= build-process-version +build-process-version: + @test -n "$(BASE)" || { echo "Error: BASE is required"; exit 1; } + @test -n "$(VERSION)" || { echo "Error: VERSION is required"; exit 1; } + @echo " -> $(BASE):$(VERSION) => $(REPO_NAME)/$(PROCESS):$(VERSION) (build)" + @docker buildx build \ + --platform $(PLATFORMS) \ + --build-arg BASE=$(BASE) \ + --build-arg BASE_VERSION=$(VERSION) \ + -t $(REPO_NAME)/$(PROCESS):$(VERSION) \ + $(PROCESS) + +# Build+push only a specific VERSION for $(PROCESS). Intended for internal use by build-push-process. +# Usage (internal): $(MAKE) BASE= VERSION= build-push-process-version +build-push-process-version: + @test -n "$(BASE)" || { echo "Error: BASE is required"; exit 1; } + @test -n "$(VERSION)" || { echo "Error: VERSION is required"; exit 1; } + @echo " -> $(BASE):$(VERSION) => $(REPO_NAME)/$(PROCESS):$(VERSION) (push)" + @docker buildx build \ + --platform $(PLATFORMS) \ + --build-arg BASE=$(BASE) \ + --build-arg BASE_VERSION=$(VERSION) \ + -t $(REPO_NAME)/$(PROCESS):$(VERSION) \ + --push \ + $(PROCESS) + +# Aliases +all: build-all +push-all: build-push-all + +# Convenience per-process targets pgvector: - $(MAKE) -C pgvector build + $(MAKE) PROCESS=pgvector build-process + +node-sqitch: + $(MAKE) PROCESS=node-sqitch build-process -# Git cleanup (repo-level only) -clean: - @git reset --hard - @git ls-files --other --exclude-standard | xargs rm -f +postgis: + $(MAKE) PROCESS=postgis build-process diff --git a/docker/node-sqitch/Dockerfile b/docker/node-sqitch/Dockerfile index e03365426..6752da686 100644 --- a/docker/node-sqitch/Dockerfile +++ b/docker/node-sqitch/Dockerfile @@ -1,5 +1,8 @@ -FROM node:20.12.0-alpine3.19 AS sqitch-build +ARG BASE=node +ARG BASE_VERSION=20.12.0-alpine3.19 +FROM ${BASE}:${BASE_VERSION} AS sqitch-build +LABEL org.opencontainers.image.source="https://github.com/launchql/launchql" # Install system dependencies. WORKDIR /work @@ -46,7 +49,11 @@ RUN apk del .build-deps ################################################################################ # Copy to the final image without all the build stuff. -FROM node:20.12.0-alpine3.19 AS sqitch +ARG BASE=node +ARG BASE_VERSION=20.12.0-alpine3.19 +FROM ${BASE}:${BASE_VERSION} AS sqitch + +LABEL org.opencontainers.image.source="https://github.com/launchql/launchql" # Install runtime system dependencies and remove unnecesary files. RUN mkdir -p /usr/share/man/man1 /usr/share/man/man7 \ @@ -82,4 +89,4 @@ ENV LESS=-R LC_ALL=C.UTF-8 LANG=C.UTF-8 SQITCH_EDITOR=vi SQITCH_PAGER=less # for gyp and such RUN apk update && apk add --no-cache bash git python3-dev make g++ -ENTRYPOINT ["/bin/sh"] \ No newline at end of file +ENTRYPOINT ["/bin/sh"] diff --git a/docker/node-sqitch/Makefile b/docker/node-sqitch/Makefile deleted file mode 100644 index 229fe3039..000000000 --- a/docker/node-sqitch/Makefile +++ /dev/null @@ -1,39 +0,0 @@ -IMAGE := pyramation/node-sqitch -TAG := 20.12.0 -PLATFORMS := linux/amd64,linux/arm64 -CONTAINER_NAME := node-sqitch - -.PHONY: build push tag-latest ssh cleanup clean-images - -build: - docker buildx build \ - --platform $(PLATFORMS) \ - -t $(IMAGE):$(TAG) \ - --output=type=docker \ - . - -push: tag-latest - docker buildx build \ - --platform $(PLATFORMS) \ - -t $(IMAGE):$(TAG) \ - -t $(IMAGE):latest \ - --push \ - . - -tag-latest: - docker tag $(IMAGE):$(TAG) $(IMAGE):latest - -ssh: - docker run --platform=linux/arm64 -it $(IMAGE):$(TAG) sh - -cleanup: - @if [ ! -z "$$(docker ps -aq -f name=$(CONTAINER_NAME))" ]; then \ - echo "Stopping and removing existing container..."; \ - docker stop $(CONTAINER_NAME) && docker rm $(CONTAINER_NAME); \ - fi - -clean-images: - @if docker images | grep $(IMAGE); then \ - echo "Removing Docker images for $(IMAGE)..."; \ - docker rmi $(IMAGE):$(TAG) $(IMAGE):latest || true; \ - fi diff --git a/docker/node-sqitch/version.yaml b/docker/node-sqitch/version.yaml new file mode 100644 index 000000000..5cceb380a --- /dev/null +++ b/docker/node-sqitch/version.yaml @@ -0,0 +1,3 @@ +base: node +versions: +- 20.12.0-alpine3.19 diff --git a/docker/pgvector/Dockerfile b/docker/pgvector/Dockerfile index 9c981d847..53c41d7c5 100644 --- a/docker/pgvector/Dockerfile +++ b/docker/pgvector/Dockerfile @@ -1,12 +1,18 @@ -FROM pyramation/postgis:13.3-alpine +ARG BASE=postgis +ARG BASE_VERSION=13.3-alpine +FROM ${BASE}:${BASE_VERSION} + +LABEL org.opencontainers.image.source="https://github.com/launchql/launchql" # Install PGVector extension RUN apk add --no-cache --virtual .build-deps \ git \ build-base \ postgresql-dev \ - && git clone --branch v0.5.1 https://github.com/pgvector/pgvector.git \ - && cd pgvector \ - && make && make install \ - && cd .. && rm -rf pgvector \ - && apk del .build-deps \ No newline at end of file + bash \ + make + +RUN git clone --branch v0.5.1 https://github.com/pgvector/pgvector.git +RUN cd pgvector && make && make install && cd .. && rm -rf pgvector + +RUN apk del .build-deps diff --git a/docker/pgvector/Makefile b/docker/pgvector/Makefile deleted file mode 100644 index 52eb95e06..000000000 --- a/docker/pgvector/Makefile +++ /dev/null @@ -1,35 +0,0 @@ -IMAGE := pyramation/pgvector -TAG := 13.3-alpine -PLATFORMS := linux/amd64,linux/arm64 -CONTAINER_NAME := pgvector - -.PHONY: build push ssh cleanup clean-images - -build: - docker buildx build \ - --platform $(PLATFORMS) \ - -t $(IMAGE):$(TAG) \ - --output=type=docker \ - . - -push: - docker buildx build \ - --platform $(PLATFORMS) \ - -t $(IMAGE):$(TAG) \ - --push \ - . - -ssh: - docker run --platform=linux/arm64 -it $(IMAGE):$(TAG) sh - -cleanup: - @if [ ! -z "$$(docker ps -aq -f name=$(CONTAINER_NAME))" ]; then \ - echo "Stopping and removing existing container..."; \ - docker stop $(CONTAINER_NAME) && docker rm $(CONTAINER_NAME); \ - fi - -clean-images: - @if docker images | grep $(IMAGE); then \ - echo "Removing Docker images for $(IMAGE)..."; \ - docker rmi $(IMAGE):$(TAG) || true; \ - fi diff --git a/docker/pgvector/version.yaml b/docker/pgvector/version.yaml new file mode 100644 index 000000000..1c7110018 --- /dev/null +++ b/docker/pgvector/version.yaml @@ -0,0 +1,3 @@ +base: postgis +versions: +- 13.3-alpine diff --git a/docker/postgis/Dockerfile b/docker/postgis/Dockerfile index ac872305e..81b560e94 100644 --- a/docker/postgis/Dockerfile +++ b/docker/postgis/Dockerfile @@ -1,3 +1,7 @@ -FROM postgres:13.3-alpine +ARG BASE=postgis +ARG BASE_VERSION=13.3-alpine +FROM ${BASE}:${BASE_VERSION} -RUN apk add make \ No newline at end of file +LABEL org.opencontainers.image.source="https://github.com/launchql/launchql" + +RUN apk add make bash diff --git a/docker/postgis/Makefile b/docker/postgis/Makefile deleted file mode 100644 index 88162d3ee..000000000 --- a/docker/postgis/Makefile +++ /dev/null @@ -1,35 +0,0 @@ -IMAGE := pyramation/postgis -TAG := 13.3-alpine -PLATFORMS := linux/amd64,linux/arm64 -CONTAINER_NAME := postgis - -.PHONY: build push ssh cleanup clean-images - -build: - docker buildx build \ - --platform $(PLATFORMS) \ - -t $(IMAGE):$(TAG) \ - --output=type=docker \ - . - -push: - docker buildx build \ - --platform $(PLATFORMS) \ - -t $(IMAGE):$(TAG) \ - --push \ - . - -ssh: - docker run --platform=linux/arm64 -it $(IMAGE):$(TAG) sh - -cleanup: - @if [ ! -z "$$(docker ps -aq -f name=$(CONTAINER_NAME))" ]; then \ - echo "Stopping and removing existing container..."; \ - docker stop $(CONTAINER_NAME) && docker rm $(CONTAINER_NAME); \ - fi - -clean-images: - @if docker images | grep $(IMAGE); then \ - echo "Removing Docker images for $(IMAGE)..."; \ - docker rmi $(IMAGE):$(TAG) || true; \ - fi diff --git a/docker/postgis/version.yaml b/docker/postgis/version.yaml new file mode 100644 index 000000000..1c7110018 --- /dev/null +++ b/docker/postgis/version.yaml @@ -0,0 +1,3 @@ +base: postgis +versions: +- 13.3-alpine From e4a515d75df56dffd0f801ec569a46ff243b1e74 Mon Sep 17 00:00:00 2001 From: Anmol1696 Date: Thu, 16 Oct 2025 21:24:01 +0400 Subject: [PATCH 02/10] update base image for pgvector and postgit --- docker/pgvector/Dockerfile | 2 +- docker/pgvector/version.yaml | 2 +- docker/postgis/Dockerfile | 2 +- docker/postgis/version.yaml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docker/pgvector/Dockerfile b/docker/pgvector/Dockerfile index 53c41d7c5..dfd968348 100644 --- a/docker/pgvector/Dockerfile +++ b/docker/pgvector/Dockerfile @@ -1,4 +1,4 @@ -ARG BASE=postgis +ARG BASE=postgres ARG BASE_VERSION=13.3-alpine FROM ${BASE}:${BASE_VERSION} diff --git a/docker/pgvector/version.yaml b/docker/pgvector/version.yaml index 1c7110018..b55a2ccd6 100644 --- a/docker/pgvector/version.yaml +++ b/docker/pgvector/version.yaml @@ -1,3 +1,3 @@ -base: postgis +base: postgres versions: - 13.3-alpine diff --git a/docker/postgis/Dockerfile b/docker/postgis/Dockerfile index 81b560e94..5d1806dfe 100644 --- a/docker/postgis/Dockerfile +++ b/docker/postgis/Dockerfile @@ -1,4 +1,4 @@ -ARG BASE=postgis +ARG BASE=postgres ARG BASE_VERSION=13.3-alpine FROM ${BASE}:${BASE_VERSION} diff --git a/docker/postgis/version.yaml b/docker/postgis/version.yaml index 1c7110018..b55a2ccd6 100644 --- a/docker/postgis/version.yaml +++ b/docker/postgis/version.yaml @@ -1,3 +1,3 @@ -base: postgis +base: postgres versions: - 13.3-alpine From 5e972db58c411cc9ffe9d2862929e08532e55770 Mon Sep 17 00:00:00 2001 From: Anmol Date: Thu, 16 Oct 2025 22:44:17 +0400 Subject: [PATCH 03/10] Update docker/Makefile Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- docker/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/docker/Makefile b/docker/Makefile index 7671fcec7..62f8b41c3 100644 --- a/docker/Makefile +++ b/docker/Makefile @@ -59,6 +59,7 @@ build-process-version: --build-arg BASE=$(BASE) \ --build-arg BASE_VERSION=$(VERSION) \ -t $(REPO_NAME)/$(PROCESS):$(VERSION) \ + --load \ $(PROCESS) # Build+push only a specific VERSION for $(PROCESS). Intended for internal use by build-push-process. From 89aa2306a9c06a4d853cdf09d7f28af8a5511458 Mon Sep 17 00:00:00 2001 From: Anmol Date: Thu, 16 Oct 2025 22:44:30 +0400 Subject: [PATCH 04/10] Update docker/postgis/Dockerfile Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- docker/postgis/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/postgis/Dockerfile b/docker/postgis/Dockerfile index 5d1806dfe..6f88892db 100644 --- a/docker/postgis/Dockerfile +++ b/docker/postgis/Dockerfile @@ -4,4 +4,4 @@ FROM ${BASE}:${BASE_VERSION} LABEL org.opencontainers.image.source="https://github.com/launchql/launchql" -RUN apk add make bash +RUN apk add --no-cache make bash From a032c62160647c9dbc9f4db43d5bd76b25b8a501 Mon Sep 17 00:00:00 2001 From: Anmol Date: Thu, 16 Oct 2025 22:44:38 +0400 Subject: [PATCH 05/10] Update docker/pgvector/Dockerfile Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- docker/pgvector/Dockerfile | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/docker/pgvector/Dockerfile b/docker/pgvector/Dockerfile index dfd968348..0018d81d3 100644 --- a/docker/pgvector/Dockerfile +++ b/docker/pgvector/Dockerfile @@ -10,9 +10,7 @@ RUN apk add --no-cache --virtual .build-deps \ build-base \ postgresql-dev \ bash \ - make - -RUN git clone --branch v0.5.1 https://github.com/pgvector/pgvector.git -RUN cd pgvector && make && make install && cd .. && rm -rf pgvector - -RUN apk del .build-deps + make && \ + git clone --branch v0.5.1 https://github.com/pgvector/pgvector.git && \ + cd pgvector && make && make install && cd .. && rm -rf pgvector && \ + apk del .build-deps From 792471ec573d9063a3d7454fa84e164661ca528b Mon Sep 17 00:00:00 2001 From: Anmol1696 Date: Thu, 16 Oct 2025 22:46:24 +0400 Subject: [PATCH 06/10] remove --load flag --- docker/Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/docker/Makefile b/docker/Makefile index 62f8b41c3..7671fcec7 100644 --- a/docker/Makefile +++ b/docker/Makefile @@ -59,7 +59,6 @@ build-process-version: --build-arg BASE=$(BASE) \ --build-arg BASE_VERSION=$(VERSION) \ -t $(REPO_NAME)/$(PROCESS):$(VERSION) \ - --load \ $(PROCESS) # Build+push only a specific VERSION for $(PROCESS). Intended for internal use by build-push-process. From 5d0520878819fc914f2ce542ef50816ee8e78580 Mon Sep 17 00:00:00 2001 From: Anmol1696 Date: Fri, 17 Oct 2025 10:13:40 +0400 Subject: [PATCH 07/10] add more versions of postgres to the images and versions --- docker/Makefile | 9 +++++---- docker/pgvector/version.yaml | 7 ++++++- docker/postgis/version.yaml | 7 ++++++- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/docker/Makefile b/docker/Makefile index 7671fcec7..c8c039098 100644 --- a/docker/Makefile +++ b/docker/Makefile @@ -16,8 +16,8 @@ CONTAINER_NAME?=$(PROCESS) ## It will build one image per version listed in $(PROCESS)/version.yaml and tag as /: build-process: @echo "==> Building process: $(PROCESS)" - @BASE=$$(sed -n 's/^base:[[:space:]]*//p' $(PROCESS)/version.yaml | head -n1); \ - VERSIONS=$$(sed -n '/^versions:/,$$p' $(PROCESS)/version.yaml | sed -n 's/^-\s*//p'); \ + @BASE=$$(sed -n 's/^[[:space:]]*base:[[:space:]]*//p' $(PROCESS)/version.yaml | head -n1); \ + VERSIONS=$$(sed -n '/^[[:space:]]*versions:/,$$p' $(PROCESS)/version.yaml | sed -n 's/^[[:space:]]*-[[:space:]]*//p'); \ if [ -z "$$BASE" ] || [ -z "$$VERSIONS" ]; then \ echo "Error: Could not parse base or versions from $(PROCESS)/version.yaml" 1>&2; \ exit 1; \ @@ -33,8 +33,8 @@ build-all: build-push-process: @echo "==> Building+Pushing process: $(PROCESS)" - @BASE=$$(sed -n 's/^base:[[:space:]]*//p' $(PROCESS)/version.yaml | head -n1); \ - VERSIONS=$$(sed -n '/^versions:/,$$p' $(PROCESS)/version.yaml | sed -n 's/^-\s*//p'); \ + @BASE=$$(sed -n 's/^[[:space:]]*base:[[:space:]]*//p' $(PROCESS)/version.yaml | head -n1); \ + VERSIONS=$$(sed -n '/^[[:space:]]*versions:/,$$p' $(PROCESS)/version.yaml | sed -n 's/^[[:space:]]*-[[:space:]]*//p'); \ if [ -z "$$BASE" ] || [ -z "$$VERSIONS" ]; then \ echo "Error: Could not parse base or versions from $(PROCESS)/version.yaml" 1>&2; \ exit 1; \ @@ -88,3 +88,4 @@ node-sqitch: postgis: $(MAKE) PROCESS=postgis build-process + diff --git a/docker/pgvector/version.yaml b/docker/pgvector/version.yaml index b55a2ccd6..c04c1f7f0 100644 --- a/docker/pgvector/version.yaml +++ b/docker/pgvector/version.yaml @@ -1,3 +1,8 @@ base: postgres versions: -- 13.3-alpine + - 13.3-alpine + - 14.19-alpine + - 15.14-alpine + - 16.10-alpine + - 17.6-alpine + - 18.0-alpine \ No newline at end of file diff --git a/docker/postgis/version.yaml b/docker/postgis/version.yaml index b55a2ccd6..e9c315571 100644 --- a/docker/postgis/version.yaml +++ b/docker/postgis/version.yaml @@ -1,3 +1,8 @@ base: postgres versions: -- 13.3-alpine + - 13.3-alpine + - 14.19-alpine + - 15.14-alpine + - 16.10-alpine + - 17.6-alpine + - 18.0-alpine From 9e555dd23483b20dee48a4a22717a826fba2513c Mon Sep 17 00:00:00 2001 From: Anmol1696 Date: Tue, 21 Oct 2025 17:47:05 +0400 Subject: [PATCH 08/10] update the base postgis dockerfile to add postgis components --- docker/pgvector/Dockerfile | 49 ++++++++++++++++++++++++------- docker/postgis/Dockerfile | 57 +++++++++++++++++++++++++++++++++++-- docker/postgis/version.yaml | 12 ++++---- 3 files changed, 100 insertions(+), 18 deletions(-) diff --git a/docker/pgvector/Dockerfile b/docker/pgvector/Dockerfile index 0018d81d3..ee533f81c 100644 --- a/docker/pgvector/Dockerfile +++ b/docker/pgvector/Dockerfile @@ -3,14 +3,43 @@ ARG BASE_VERSION=13.3-alpine FROM ${BASE}:${BASE_VERSION} LABEL org.opencontainers.image.source="https://github.com/launchql/launchql" +ARG BASE +ARG BASE_VERSION +ARG PGVECTOR_REF="v0.8.1" +ENV BASE_VERSION=${BASE_VERSION} +ENV PGVECTOR_REF=${PGVECTOR_REF} -# Install PGVector extension -RUN apk add --no-cache --virtual .build-deps \ - git \ - build-base \ - postgresql-dev \ - bash \ - make && \ - git clone --branch v0.5.1 https://github.com/pgvector/pgvector.git && \ - cd pgvector && make && make install && cd .. && rm -rf pgvector && \ - apk del .build-deps +# Install PGVector extension with LLVM bitcode enabled. +# - Detect OS (Alpine vs Debian) and install matching LLVM/clang per pg_config +RUN set -eux; \ + : "${BASE_VERSION:?BASE_VERSION not set}"; \ + if [ -f /etc/alpine-release ]; then \ + apk add --no-cache --virtual .build-deps git build-base bash make curl ca-certificates; \ + LLVM_CFG=$(pg_config --configure | tr ' ' '\n' | sed -n 's/^LLVM_CONFIG=\(.*\)$/\1/p' | tr -d '\"\'\'' ); \ + [ -n "${LLVM_CFG}" ] || { echo "Server not built with LLVM (LLVM_CONFIG missing)" >&2; exit 1; }; \ + LLVM_VER=$(echo "${LLVM_CFG}" | sed -E 's#.*/llvm-?([0-9]+)/.*#\1#'); \ + [ -n "${LLVM_VER}" ] || { echo "Could not determine LLVM version from: ${LLVM_CFG}" >&2; exit 1; }; \ + apk add --no-cache --virtual .clang \ + "clang${LLVM_VER}" \ + "llvm${LLVM_VER}" \ + "llvm${LLVM_VER}-libs" \ + "llvm${LLVM_VER}-linker-tools"; \ + git clone --quiet --depth 1 --branch "${PGVECTOR_REF}" https://github.com/pgvector/pgvector.git; \ + cd pgvector && make && make install; \ + cd .. && rm -rf pgvector; \ + apk del .clang .build-deps; \ + else \ + export DEBIAN_FRONTEND=noninteractive; \ + apt-get update; \ + apt-get install -y --no-install-recommends ca-certificates curl gnupg build-essential git make; \ + LLVM_CFG=$(pg_config --configure | tr ' ' '\n' | sed -n 's/^LLVM_CONFIG=\(.*\)$/\1/p' | tr -d '\"\'\'' ); \ + [ -n "${LLVM_CFG}" ] || { echo "Server not built with LLVM (LLVM_CONFIG missing)" >&2; exit 1; }; \ + LLVM_VER=$(echo "${LLVM_CFG}" | sed -E 's#.*/llvm-?([0-9]+)/.*#\1#'); \ + [ -n "${LLVM_VER}" ] || { echo "Could not determine LLVM version from: ${LLVM_CFG}" >&2; exit 1; }; \ + apt-get install -y --no-install-recommends "llvm-${LLVM_VER}" "clang-${LLVM_VER}"; \ + git clone --quiet --depth 1 --branch "${PGVECTOR_REF}" https://github.com/pgvector/pgvector.git; \ + cd pgvector && make && make install; \ + cd .. && rm -rf pgvector; \ + apt-get purge -y --auto-remove build-essential git make curl gnupg "llvm-${LLVM_VER}" "clang-${LLVM_VER}"; \ + rm -rf /var/lib/apt/lists/*; \ + fi diff --git a/docker/postgis/Dockerfile b/docker/postgis/Dockerfile index 6f88892db..5ef75570f 100644 --- a/docker/postgis/Dockerfile +++ b/docker/postgis/Dockerfile @@ -1,7 +1,60 @@ ARG BASE=postgres -ARG BASE_VERSION=13.3-alpine +ARG BASE_VERSION=13.3 FROM ${BASE}:${BASE_VERSION} LABEL org.opencontainers.image.source="https://github.com/launchql/launchql" +ARG BASE +ARG BASE_VERSION +ENV BASE_VERSION=${BASE_VERSION} -RUN apk add --no-cache make bash +# Install PostGIS extension +# - Detect PostgreSQL major version and install matching PostGIS packages +# - Handle archived Debian releases (Buster and earlier) +# - Ensure CA certificates exist before hitting apt-archive.postgresql.org over HTTPS +RUN set -eux; \ + export DEBIAN_FRONTEND=noninteractive; \ + PGDG_FILE="/etc/apt/sources.list.d/pgdg.list"; \ + # Temporarily disable PGDG so we can first try Debian's own repos + [ -f "$PGDG_FILE" ] && mv "$PGDG_FILE" "$PGDG_FILE.disabled" || true; \ + \ + # If the base Debian release is EOL, switch to archive.debian.org for Debian repos + if ! apt-get update 2>/dev/null; then \ + sed -i 's|http://deb.debian.org/debian|http://archive.debian.org/debian|g' /etc/apt/sources.list; \ + sed -i 's|http://security.debian.org/debian-security|http://archive.debian.org/debian-security|g' /etc/apt/sources.list; \ + sed -i '/-updates/d' /etc/apt/sources.list || true; \ + fi; \ + \ + # Update and install CA certificates so HTTPS apt repos work + apt-get update; \ + apt-get install -y --no-install-recommends ca-certificates gnupg dirmngr; \ + update-ca-certificates || true; \ + \ + # Determine server major version + PG_MAJOR=$(pg_config --version | sed 's/^PostgreSQL \([0-9]\+\).*/\1/'); \ + \ + # If Debian repos don't have PostGIS for this PG major, enable PGDG (archive only for EOL codenames) + if ! apt-cache show "postgresql-${PG_MAJOR}-postgis-3" >/dev/null 2>&1; then \ + CODENAME=$(. /etc/os-release && echo "$VERSION_CODENAME"); \ + case "$CODENAME" in \ + stretch|buster) PGDG_URL="https://apt-archive.postgresql.org/pub/repos/apt" ;; \ + *) PGDG_URL="https://apt.postgresql.org/pub/repos/apt" ;; \ + esac; \ + if [ -f "$PGDG_FILE.disabled" ]; then \ + sed -E 's#https?://(apt|apt-archive)\.postgresql\.org/pub/repos/apt#'"$PGDG_URL"'#g' "$PGDG_FILE.disabled" \ + | sed -E "s# (stretch|buster|bullseye|bookworm|trixie)-pgdg # ${CODENAME}-pgdg #g" \ + > "$PGDG_FILE"; \ + rm -f "$PGDG_FILE.disabled"; \ + else \ + echo "deb $PGDG_URL ${CODENAME}-pgdg main" > "$PGDG_FILE"; \ + fi; \ + apt-get update; \ + fi; \ + \ + # Install PostGIS matching PG major + apt-get install -y --no-install-recommends \ + postgresql-${PG_MAJOR}-postgis-3 \ + postgresql-${PG_MAJOR}-postgis-3-scripts \ + postgis \ + make \ + bash; \ + rm -rf /var/lib/apt/lists/* diff --git a/docker/postgis/version.yaml b/docker/postgis/version.yaml index e9c315571..0dd501aaf 100644 --- a/docker/postgis/version.yaml +++ b/docker/postgis/version.yaml @@ -1,8 +1,8 @@ base: postgres versions: - - 13.3-alpine - - 14.19-alpine - - 15.14-alpine - - 16.10-alpine - - 17.6-alpine - - 18.0-alpine + - 13.3 + - 14.19 + - 15.14 + - 16.10 + - 17.6 + - 18.0 From 4758eac1ce8faf331debbb03ca1a2e47058db7fa Mon Sep 17 00:00:00 2001 From: Anmol1696 Date: Thu, 23 Oct 2025 17:12:30 +0400 Subject: [PATCH 09/10] add pgvector-postgis and others version --- .github/workflows/docker.yaml | 3 +- docker/Makefile | 6 ++-- docker/pgvector-postgis/Dockerfile | 30 ++++++++++++++++ docker/pgvector-postgis/version.yaml | 8 +++++ docker/pgvector/Dockerfile | 53 +++++++++------------------- docker/pgvector/Dockerfile.alpine | 29 +++++++++++++++ docker/pgvector/version.yaml | 11 +++--- 7 files changed, 95 insertions(+), 45 deletions(-) create mode 100644 docker/pgvector-postgis/Dockerfile create mode 100644 docker/pgvector-postgis/version.yaml create mode 100644 docker/pgvector/Dockerfile.alpine diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index 3fd8c17cf..e2cf9334a 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -27,6 +27,7 @@ on: - pgvector - node-sqitch - postgis + - pgvector-postgis default: pgvector version: description: 'Specific version to build (must exist in version.yaml)' @@ -52,7 +53,7 @@ jobs: strategy: matrix: - process: [pgvector, node-sqitch, postgis] + process: [pgvector, node-sqitch, postgis, pgvector-postgis] max-parallel: 3 env: diff --git a/docker/Makefile b/docker/Makefile index c8c039098..8b8e6ffcc 100644 --- a/docker/Makefile +++ b/docker/Makefile @@ -8,7 +8,7 @@ PLATFORMS?=linux/arm64 PROCESS?=pgvector # Convenience: list of known processes -PROCESSES:=pgvector node-sqitch postgis +PROCESSES:=pgvector node-sqitch postgis pgvector-postgis CONTAINER_NAME?=$(PROCESS) @@ -87,5 +87,7 @@ node-sqitch: $(MAKE) PROCESS=node-sqitch build-process postgis: - $(MAKE) PROCESS=postgis build-process + $(MAKE) PROCESS=postgis build-process +pgvector-postgis: + $(MAKE) PROCESS=pgvector-postgis build-process diff --git a/docker/pgvector-postgis/Dockerfile b/docker/pgvector-postgis/Dockerfile new file mode 100644 index 000000000..94ee4a0ec --- /dev/null +++ b/docker/pgvector-postgis/Dockerfile @@ -0,0 +1,30 @@ +ARG BASE=postgres +ARG BASE_VERSION=14 +FROM ${BASE}:${BASE_VERSION} + +LABEL org.opencontainers.image.source="https://github.com/launchql/launchql" +ARG BASE +ARG BASE_VERSION +ENV BASE_VERSION=${BASE_VERSION} + +# Debian-based: install both pgvector and postgis from PGDG per-PG-major +RUN set -eux; \ + export DEBIAN_FRONTEND=noninteractive; \ + apt-get update; \ + apt-get install -y --no-install-recommends ca-certificates curl gnupg dirmngr; \ + update-ca-certificates || true; \ + CODENAME=$(. /etc/os-release && echo "$VERSION_CODENAME"); \ + install -d -m 0755 /usr/share/keyrings; \ + curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor -o /usr/share/keyrings/postgresql.gpg; \ + echo "deb [signed-by=/usr/share/keyrings/postgresql.gpg] https://apt.postgresql.org/pub/repos/apt ${CODENAME}-pgdg main" > /etc/apt/sources.list.d/pgdg.list; \ + apt-get update; \ + PG_MAJOR=$(pg_config --version | sed 's/^PostgreSQL \([0-9]\+\).*/\1/'); \ + apt-get install -y --no-install-recommends \ + postgresql-${PG_MAJOR}-postgis-3 \ + postgresql-${PG_MAJOR}-postgis-3-scripts \ + postgis \ + postgresql-${PG_MAJOR}-pgvector \ + make \ + bash; \ + rm -rf /var/lib/apt/lists/* + diff --git a/docker/pgvector-postgis/version.yaml b/docker/pgvector-postgis/version.yaml new file mode 100644 index 000000000..56534546b --- /dev/null +++ b/docker/pgvector-postgis/version.yaml @@ -0,0 +1,8 @@ +base: postgres +versions: + - 14.19 + - 15.14 + - 16.10 + - 17.6 + - 18.0 + diff --git a/docker/pgvector/Dockerfile b/docker/pgvector/Dockerfile index ee533f81c..dca8b321b 100644 --- a/docker/pgvector/Dockerfile +++ b/docker/pgvector/Dockerfile @@ -1,45 +1,26 @@ ARG BASE=postgres -ARG BASE_VERSION=13.3-alpine +ARG BASE_VERSION=14 FROM ${BASE}:${BASE_VERSION} LABEL org.opencontainers.image.source="https://github.com/launchql/launchql" ARG BASE ARG BASE_VERSION -ARG PGVECTOR_REF="v0.8.1" ENV BASE_VERSION=${BASE_VERSION} -ENV PGVECTOR_REF=${PGVECTOR_REF} -# Install PGVector extension with LLVM bitcode enabled. -# - Detect OS (Alpine vs Debian) and install matching LLVM/clang per pg_config +# Debian-based install: use PGDG per-PG-major package RUN set -eux; \ - : "${BASE_VERSION:?BASE_VERSION not set}"; \ - if [ -f /etc/alpine-release ]; then \ - apk add --no-cache --virtual .build-deps git build-base bash make curl ca-certificates; \ - LLVM_CFG=$(pg_config --configure | tr ' ' '\n' | sed -n 's/^LLVM_CONFIG=\(.*\)$/\1/p' | tr -d '\"\'\'' ); \ - [ -n "${LLVM_CFG}" ] || { echo "Server not built with LLVM (LLVM_CONFIG missing)" >&2; exit 1; }; \ - LLVM_VER=$(echo "${LLVM_CFG}" | sed -E 's#.*/llvm-?([0-9]+)/.*#\1#'); \ - [ -n "${LLVM_VER}" ] || { echo "Could not determine LLVM version from: ${LLVM_CFG}" >&2; exit 1; }; \ - apk add --no-cache --virtual .clang \ - "clang${LLVM_VER}" \ - "llvm${LLVM_VER}" \ - "llvm${LLVM_VER}-libs" \ - "llvm${LLVM_VER}-linker-tools"; \ - git clone --quiet --depth 1 --branch "${PGVECTOR_REF}" https://github.com/pgvector/pgvector.git; \ - cd pgvector && make && make install; \ - cd .. && rm -rf pgvector; \ - apk del .clang .build-deps; \ - else \ - export DEBIAN_FRONTEND=noninteractive; \ - apt-get update; \ - apt-get install -y --no-install-recommends ca-certificates curl gnupg build-essential git make; \ - LLVM_CFG=$(pg_config --configure | tr ' ' '\n' | sed -n 's/^LLVM_CONFIG=\(.*\)$/\1/p' | tr -d '\"\'\'' ); \ - [ -n "${LLVM_CFG}" ] || { echo "Server not built with LLVM (LLVM_CONFIG missing)" >&2; exit 1; }; \ - LLVM_VER=$(echo "${LLVM_CFG}" | sed -E 's#.*/llvm-?([0-9]+)/.*#\1#'); \ - [ -n "${LLVM_VER}" ] || { echo "Could not determine LLVM version from: ${LLVM_CFG}" >&2; exit 1; }; \ - apt-get install -y --no-install-recommends "llvm-${LLVM_VER}" "clang-${LLVM_VER}"; \ - git clone --quiet --depth 1 --branch "${PGVECTOR_REF}" https://github.com/pgvector/pgvector.git; \ - cd pgvector && make && make install; \ - cd .. && rm -rf pgvector; \ - apt-get purge -y --auto-remove build-essential git make curl gnupg "llvm-${LLVM_VER}" "clang-${LLVM_VER}"; \ - rm -rf /var/lib/apt/lists/*; \ - fi + export DEBIAN_FRONTEND=noninteractive; \ + apt-get update; \ + apt-get install -y --no-install-recommends ca-certificates curl gnupg dirmngr; \ + update-ca-certificates || true; \ + CODENAME=$(. /etc/os-release && echo "$VERSION_CODENAME"); \ + install -d -m 0755 /usr/share/keyrings; \ + curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor -o /usr/share/keyrings/postgresql.gpg; \ + echo "deb [signed-by=/usr/share/keyrings/postgresql.gpg] https://apt.postgresql.org/pub/repos/apt ${CODENAME}-pgdg main" > /etc/apt/sources.list.d/pgdg.list; \ + apt-get update; \ + PG_MAJOR=$(pg_config --version | sed 's/^PostgreSQL \([0-9]\+\).*/\1/'); \ + apt-get install -y --no-install-recommends \ + postgresql-${PG_MAJOR}-pgvector \ + make \ + bash; \ + rm -rf /var/lib/apt/lists/* diff --git a/docker/pgvector/Dockerfile.alpine b/docker/pgvector/Dockerfile.alpine new file mode 100644 index 000000000..1d99282bb --- /dev/null +++ b/docker/pgvector/Dockerfile.alpine @@ -0,0 +1,29 @@ +ARG BASE=postgres +ARG BASE_VERSION=13.3-alpine +FROM ${BASE}:${BASE_VERSION} + +LABEL org.opencontainers.image.source="https://github.com/launchql/launchql" +ARG BASE +ARG BASE_VERSION +ARG PGVECTOR_REF="v0.8.1" +ENV BASE_VERSION=${BASE_VERSION} +ENV PGVECTOR_REF=${PGVECTOR_REF} + +# Alpine build (kept as a backup variant) +RUN set -eux; \ + : "${BASE_VERSION:?BASE_VERSION not set}"; \ + apk add --no-cache --virtual .build-deps git build-base bash make curl ca-certificates; \ + LLVM_CFG=$(pg_config --configure | tr ' ' '\n' | sed -n 's/^LLVM_CONFIG=\(.*\)$/\1/p' | tr -d '\"\'\'' ); \ + [ -n "${LLVM_CFG}" ] || { echo "Server not built with LLVM (LLVM_CONFIG missing)" >&2; exit 1; }; \ + LLVM_VER=$(echo "${LLVM_CFG}" | sed -E 's#.*/llvm-?([0-9]+)/.*#\1#'); \ + [ -n "${LLVM_VER}" ] || { echo "Could not determine LLVM version from: ${LLVM_CFG}" >&2; exit 1; }; \ + apk add --no-cache --virtual .clang \ + "clang${LLVM_VER}" \ + "llvm${LLVM_VER}" \ + "llvm${LLVM_VER}-libs" \ + "llvm${LLVM_VER}-linker-tools"; \ + git clone --quiet --depth 1 --branch "${PGVECTOR_REF}" https://github.com/pgvector/pgvector.git; \ + cd pgvector && make && make install; \ + cd .. && rm -rf pgvector; \ + apk del .clang .build-deps + diff --git a/docker/pgvector/version.yaml b/docker/pgvector/version.yaml index c04c1f7f0..b126d0b08 100644 --- a/docker/pgvector/version.yaml +++ b/docker/pgvector/version.yaml @@ -1,8 +1,7 @@ base: postgres versions: - - 13.3-alpine - - 14.19-alpine - - 15.14-alpine - - 16.10-alpine - - 17.6-alpine - - 18.0-alpine \ No newline at end of file + - 14.19 + - 15.14 + - 16.10 + - 17.6 + - 18.0 From b55db9ca26db009296b39740023800ecaafb1759 Mon Sep 17 00:00:00 2001 From: Anmol1696 Date: Thu, 23 Oct 2025 18:01:19 +0400 Subject: [PATCH 10/10] fix tab for make command --- docker/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker/Makefile b/docker/Makefile index 8b8e6ffcc..5964b5090 100644 --- a/docker/Makefile +++ b/docker/Makefile @@ -87,7 +87,7 @@ node-sqitch: $(MAKE) PROCESS=node-sqitch build-process postgis: - $(MAKE) PROCESS=postgis build-process + $(MAKE) PROCESS=postgis build-process pgvector-postgis: - $(MAKE) PROCESS=pgvector-postgis build-process + $(MAKE) PROCESS=pgvector-postgis build-process