From 4e8c83a44787f5d28628f86a34d88378b9044621 Mon Sep 17 00:00:00 2001 From: Daniel Muehlbachler-Pietrzykowski Date: Fri, 3 Oct 2025 11:05:53 +0200 Subject: [PATCH] feat: download vchord from github releases BREAKING CHANGE: revert to postgres 16.8 --- .github/workflows/release.yml | 5 +++-- .github/workflows/verify.yml | 5 +++-- Dockerfile | 24 +++++++++++++++--------- 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 26cfa7b..8be6562 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -63,8 +63,8 @@ jobs: POSTGRESQL_IMAGE=$(cat Dockerfile | grep 'FROM ghcr.io/cloudnative-pg/postgresql:') POSTGRESQL_FROM_TAG=$(echo $POSTGRESQL_IMAGE | cut -d':' -f2 | cut -d'@' -f1) echo "postgresql=${POSTGRESQL_FROM_TAG}" >> "$GITHUB_OUTPUT" - VECTORCHORD_IMAGE=$(cat Dockerfile | grep 'FROM tensorchord/vchord-binary:') - VECTORCHORD_FROM_TAG=$(echo $VECTORCHORD_IMAGE | cut -d'-' -f3) + VECTORCHORD_IMAGE=$(cat Dockerfile | grep -m 1 'ARG VCHORD_VERSION') + VECTORCHORD_FROM_TAG=$(echo $VECTORCHORD_IMAGE | cut -d'=' -f2) echo "vchord=${VECTORCHORD_FROM_TAG}" >> "$GITHUB_OUTPUT" - uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0 @@ -82,3 +82,4 @@ jobs: CI_COMMIT_SHA=${{ github.sha }} CI_COMMIT_TAG=${{ steps.from_tag.outputs.postgresql }}-${{ steps.from_tag.outputs.vchord }}-${{ needs.release.outputs.tag_name }} CI_UPSTREAM_VERSION=${{ steps.from_tag.outputs.postgresql }}-${{ steps.from_tag.outputs.vchord }} + VCHORD_VERSION=${{ steps.from_tag.outputs.vchord }} diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml index a5906ed..27fa58a 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/verify.yml @@ -69,8 +69,8 @@ jobs: POSTGRESQL_IMAGE=$(cat Dockerfile | grep 'FROM ghcr.io/cloudnative-pg/postgresql:') POSTGRESQL_FROM_TAG=$(echo $POSTGRESQL_IMAGE | cut -d':' -f2 | cut -d'@' -f1) echo "postgresql=${POSTGRESQL_FROM_TAG}" >> "$GITHUB_OUTPUT" - VECTORCHORD_IMAGE=$(cat Dockerfile | grep 'FROM tensorchord/vchord-binary:') - VECTORCHORD_FROM_TAG=$(echo $VECTORCHORD_IMAGE | cut -d'-' -f3) + VECTORCHORD_IMAGE=$(cat Dockerfile | grep -m 1 'ARG VCHORD_VERSION') + VECTORCHORD_FROM_TAG=$(echo $VECTORCHORD_IMAGE | cut -d'=' -f2) echo "vchord=${VECTORCHORD_FROM_TAG}" >> "$GITHUB_OUTPUT" - uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0 @@ -86,3 +86,4 @@ jobs: CI_COMMIT_SHA=${{ github.sha }} CI_COMMIT_TAG=latest CI_UPSTREAM_VERSION=${{ steps.from_tag.outputs.postgresql }}-${{ steps.from_tag.outputs.vchord }} + VCHORD_VERSION=${{ steps.from_tag.outputs.vchord }} diff --git a/Dockerfile b/Dockerfile index fb76c1e..83ce07b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,18 +2,18 @@ ARG CI_COMMIT_TIMESTAMP ARG CI_COMMIT_SHA ARG CI_COMMIT_TAG ARG CI_UPSTREAM_VERSION - -# vchord binary container -FROM tensorchord/vchord-binary:pg17-v0.4.3-${TARGETARCH} as vchord +ARG VCHORD_VERSION=0.4.3 # main container -FROM ghcr.io/cloudnative-pg/postgresql:17.5-7@sha256:ce4f594010149f48592359ddd87fb0ba8a99cbc871965d2aaa770d025c5c6025 +FROM ghcr.io/cloudnative-pg/postgresql:16.8-14@sha256:ed9bd4a26b152cf35f2c64e15f48126e3477ad222cfb04794562bdc999b8f0be + +ARG VCHORD_VERSION LABEL org.opencontainers.image.authors="Daniel Muehlbachler-Pietrzykowski " LABEL org.opencontainers.image.vendor="Daniel Muehlbachler-Pietrzykowski" LABEL org.opencontainers.image.source="https://github.com/muhlba91/postgresql-pgvecto-container" LABEL org.opencontainers.image.created="${CI_COMMIT_TIMESTAMP}" -LABEL org.opencontainers.image.title="cloudnativepg-postgresql-vchord" +LABEL org.opencontainers.image.title="cloudnativepg-postgresql-vectorchord" LABEL org.opencontainers.image.description="A container integrating VectorChord into CloudNativePG PostgreSQL" LABEL org.opencontainers.image.revision="${CI_COMMIT_SHA}" LABEL org.opencontainers.image.version="${CI_COMMIT_TAG}" @@ -22,11 +22,17 @@ LABEL org.opencontainers.image.upstream="${CI_UPSTREAM_VERSION}" # use root to install binaries USER root -# taken from https://github.com/tensorchord/VectorChord/ -COPY --from=vchord /workspace/postgresql-*.deb /tmp/vchord.deb -RUN apt-get install --yes --no-install-recommends /tmp/vchord.deb && rm -f /tmp/vchord.deb +# taken from: https://github.com/tensorchord/VectorChord-images +# hadolint ignore=DL3008,DL3015,SC2046 +RUN apt-get update && \ + apt-get install -y --no-install-recommends wget ca-certificates && \ + wget -q https://github.com/tensorchord/VectorChord/releases/download/${VCHORD_VERSION}/postgresql-16-vchord_${VCHORD_VERSION}-1_$(dpkg --print-architecture).deb -P /tmp && \ + apt-get install -y /tmp/postgresql-16-vchord_${VCHORD_VERSION}-1_$(dpkg --print-architecture).deb && \ + apt-get remove -y wget ca-certificates && \ + apt-get purge -y --auto-remove && \ + rm -rf /tmp/* /var/lib/apt/lists/* # set user back to postgres USER 26 -CMD ["postgres", "-c" ,"shared_preload_libraries=vchord.so", "-c", "search_path=\"$user\", public, vectors", "-c", "logging_collector=on"] +CMD ["postgres", "-c" ,"shared_preload_libraries=vchord.so"]