Skip to content

Commit cc2160c

Browse files
committed
feat: implement dynamic vectorchord version discovery
1 parent 1f5554c commit cc2160c

2 files changed

Lines changed: 16 additions & 10 deletions

File tree

Containerfile

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,18 @@ WORKDIR /usr/ports/databases/pgvector
2626
RUN make DEFAULT_VERSIONS+=pgsql=${PG_VERSION} BATCH=yes install clean
2727

2828
# Build VectorChord from source
29-
ARG VECTORCHORD_VERSION=0.4.3
30-
RUN fetch -qo /tmp/vectorchord.tar.gz \
29+
ARG VECTORCHORD_VERSION=latest
30+
RUN if [ "${VECTORCHORD_VERSION}" = "latest" ]; then \
31+
VECTORCHORD_VERSION=$(fetch -qo - https://api.github.com/repos/tensorchord/VectorChord/releases/latest | grep -o '"tag_name":"[^"]*"' | head -1 | cut -d'"' -f4); \
32+
fi && \
33+
echo "Building VectorChord ${VECTORCHORD_VERSION}..." && \
34+
fetch -qo /tmp/vectorchord.tar.gz \
3135
"https://github.com/tensorchord/VectorChord/archive/refs/tags/${VECTORCHORD_VERSION}.tar.gz" && \
3236
tar -xzf /tmp/vectorchord.tar.gz -C /tmp && \
3337
cd /tmp/VectorChord-${VECTORCHORD_VERSION} && \
3438
gmake build && \
35-
gmake install
39+
gmake install && \
40+
mkdir -p /app && echo "${VECTORCHORD_VERSION}" > /app/vectorchord-version
3641

3742
# Production image
3843
FROM ghcr.io/daemonless/postgres:${PG_VERSION}
@@ -69,10 +74,6 @@ COPY --from=builder /usr/local/share/postgresql/extension/vchord* /usr/local/sha
6974
RUN chmod 644 /usr/local/share/postgresql/extension/vchord* && \
7075
chmod 755 /usr/local/lib/postgresql/vchord.so
7176

72-
# Extract version
73-
RUN mkdir -p /app && \
74-
pkg query '%v' postgresql${PG_VERSION}-server | sed 's/_.*$//' > /app/version
75-
7677
# Copy init scripts for extensions
7778
COPY docker-entrypoint-initdb.d/ /docker-entrypoint-initdb.d/
7879
RUN chmod 644 /docker-entrypoint-initdb.d/*

Containerfile.j2

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,18 @@ WORKDIR /usr/ports/databases/pgvector
2626
RUN make DEFAULT_VERSIONS+=pgsql=${PG_VERSION} BATCH=yes install clean
2727

2828
# Build VectorChord from source
29-
ARG VECTORCHORD_VERSION=0.4.3
30-
RUN fetch -qo /tmp/vectorchord.tar.gz \
29+
ARG VECTORCHORD_VERSION=latest
30+
RUN if [ "${VECTORCHORD_VERSION}" = "latest" ]; then \
31+
VECTORCHORD_VERSION=$(fetch -qo - https://api.github.com/repos/tensorchord/VectorChord/releases/latest | grep -o '"tag_name":"[^"]*"' | head -1 | cut -d'"' -f4); \
32+
fi && \
33+
echo "Building VectorChord ${VECTORCHORD_VERSION}..." && \
34+
fetch -qo /tmp/vectorchord.tar.gz \
3135
"https://github.com/tensorchord/VectorChord/archive/refs/tags/${VECTORCHORD_VERSION}.tar.gz" && \
3236
tar -xzf /tmp/vectorchord.tar.gz -C /tmp && \
3337
cd /tmp/VectorChord-${VECTORCHORD_VERSION} && \
3438
gmake build && \
35-
gmake install
39+
gmake install && \
40+
mkdir -p /app && echo "${VECTORCHORD_VERSION}" > /app/vectorchord-version
3641

3742
# Production image
3843
FROM ghcr.io/daemonless/postgres:${PG_VERSION}

0 commit comments

Comments
 (0)