From 612788d74979325dd9dde9f51f79c4e30f4a2162 Mon Sep 17 00:00:00 2001 From: Daniel Muehlbachler-Pietrzykowski Date: Fri, 3 Oct 2025 11:40:37 +0200 Subject: [PATCH] feat: name images differently --- .github/workflows/release.yml | 7 +++++-- .github/workflows/verify.yml | 7 +++++-- Dockerfile | 13 ++++++------- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8be6562..4da45df 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -61,8 +61,10 @@ jobs: id: from_tag run: | 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" + POSTGRESQL_VERSION=$(echo $POSTGRESQL_IMAGE | cut -d':' -f2 | cut -d'@' -f1 | cut -d'-' -f1) + echo "postgresql=${POSTGRESQL_VERSION}" >> "$GITHUB_OUTPUT" + POSTGRESQL_MAJOR_VERSION=$(echo $POSTGRESQL_VERSION | cut -d'.' -f1) + echo "postgresql_major=${POSTGRESQL_MAJOR_VERSION}" >> "$GITHUB_OUTPUT" 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" @@ -82,4 +84,5 @@ 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 }} + POSTGRESQL_MAJOR_VERSION=${{ steps.from_tag.outputs.postgresql_major }} VCHORD_VERSION=${{ steps.from_tag.outputs.vchord }} diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml index 27fa58a..ac62a1b 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/verify.yml @@ -67,8 +67,10 @@ jobs: id: from_tag run: | 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" + POSTGRESQL_VERSION=$(echo $POSTGRESQL_IMAGE | cut -d':' -f2 | cut -d'@' -f1 | cut -d'-' -f1) + echo "postgresql=${POSTGRESQL_VERSION}" >> "$GITHUB_OUTPUT" + POSTGRESQL_MAJOR_VERSION=$(echo $POSTGRESQL_VERSION | cut -d'.' -f1) + echo "postgresql_major=${POSTGRESQL_MAJOR_VERSION}" >> "$GITHUB_OUTPUT" 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" @@ -86,4 +88,5 @@ jobs: CI_COMMIT_SHA=${{ github.sha }} CI_COMMIT_TAG=latest CI_UPSTREAM_VERSION=${{ steps.from_tag.outputs.postgresql }}-${{ steps.from_tag.outputs.vchord }} + POSTGRESQL_MAJOR_VERSION=${{ steps.from_tag.outputs.postgresql_major }} VCHORD_VERSION=${{ steps.from_tag.outputs.vchord }} diff --git a/Dockerfile b/Dockerfile index 82b8e28..219b343 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,13 @@ +# main container +FROM ghcr.io/cloudnative-pg/postgresql:16.10-standard-bookworm@sha256:e6f87c0d1ce52cb450d3fd2701ddf6dbf4e1621f52aae9237c12705434c68b51 + ARG CI_COMMIT_TIMESTAMP ARG CI_COMMIT_SHA ARG CI_COMMIT_TAG ARG CI_UPSTREAM_VERSION +ARG POSTGRESQL_MAJOR_VERSION=16 ARG VCHORD_VERSION=0.4.3 -# main container -FROM ghcr.io/cloudnative-pg/postgresql:16.10-standard-bookworm@sha256:e6f87c0d1ce52cb450d3fd2701ddf6dbf4e1621f52aae9237c12705434c68b51 - -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" @@ -26,8 +25,8 @@ USER root # 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 && \ + wget -q https://github.com/tensorchord/VectorChord/releases/download/${VCHORD_VERSION}/postgresql-${POSTGRESQL_MAJOR_VERSION}-vchord_${VCHORD_VERSION}-1_$(dpkg --print-architecture).deb -P /tmp && \ + apt-get install -y /tmp/postgresql-${POSTGRESQL_MAJOR_VERSION}-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/*