Skip to content

Commit

Permalink
feat: update PostgreSQL workflow and Dockerfile for version 17, remov…
Browse files Browse the repository at this point in the history
…e trafficserver workflow
  • Loading branch information
bhunter234 committed Jan 17, 2025
1 parent 6372eb0 commit 942f751
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 252 deletions.
23 changes: 18 additions & 5 deletions .github/workflows/postgres.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
workflow_dispatch:

env:
BUILD_VERSION: "17-alpine"
PG_MAJOR: "17"
REPOSITORY: tgdrive/${{ github.workflow }}

jobs:
Expand Down Expand Up @@ -37,22 +37,35 @@ jobs:
with:
images: ${{ env.REPOSITORY }}
labels: |
org.opencontainers.image.version=${{ env.BUILD_VERSION }}
org.opencontainers.image.version=${{ env.PG_MAJOR}}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.title=${{ env.REPOSITORY }}
- name: PgVecto Version
id: pgvecto
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
apt update && apt install -y curl jq
LATEST_TAG=$(curl -sL \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GH_TOKEN" \
"https://api.github.com/repos/tensorchord/pgvecto.rs/releases/latest" | \
jq -r .tag_name)
echo "latest_tag=${LATEST_TAG}" >> $GITHUB_OUTPUT
- name: Build Image
uses: docker/build-push-action@v6
with:
context: ./postgres
push: true
platforms: linux/amd64,linux/arm64
build-args: |
BUILD_VERSION
PG_MAJOR
PGVECTO_TAG=${{ steps.pgvecto.outputs.latest_tag }}
labels: ${{ steps.docker_meta.outputs.labels }}
sbom: true
provenance: true
cache-from: type=gha, scope=${{ github.workflow }}
cache-to: type=gha, scope=${{ github.workflow }}
tags: |
ghcr.io/${{ env.REPOSITORY }}:${{ env.BUILD_VERSION }}
ghcr.io/${{ env.REPOSITORY }}:${{ env.PG_MAJOR }}
57 changes: 0 additions & 57 deletions .github/workflows/trafficserver.yml

This file was deleted.

85 changes: 38 additions & 47 deletions postgres/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,47 +1,38 @@

ARG BUILD_VERSION=17-alpine

FROM postgres:${BUILD_VERSION}

ARG PGROONGA_VERSION=3.2.4
ARG GROONGA_VERSION=14.0.9

ENV PGROONGA_VERSION=${PGROONGA_VERSION} \
GROONGA_VERSION=${GROONGA_VERSION}

COPY build.sh /
RUN chmod +x /build.sh
RUN \
apk add --no-cache --virtual=.build-dependencies \
apache-arrow-dev \
build-base \
clang15-dev \
cmake \
git \
gettext-dev \
linux-headers \
llvm15 \
lz4-dev \
msgpack-c-dev \
rapidjson-dev \
ruby \
samurai \
xsimd-dev \
xxhash-dev \
zlib-dev \
zstd-dev && \
/build.sh && \
rm -f build.sh && \
apk del .build-dependencies && \
apk add --no-cache \
libarrow \
libxxhash \
msgpack-c \
zlib \
zstd

COPY start.sh /usr/local/bin/

RUN chmod +x /usr/local/bin/start.sh

ENTRYPOINT ["start.sh"]
ARG TARGETARCH
ARG PG_MAJOR=17
ARG PGVECTO_TAG=v0.4.0

FROM tensorchord/pgvecto-rs-binary:pg${PG_MAJOR}-${PGVECTO_TAG}-${TARGETARCH} as binary

FROM groonga/pgroonga:latest-debian-${PG_MAJOR}

COPY --from=binary /pgvecto-rs-binary-release.deb /tmp/vectors.deb

RUN <<EOR
apt-get update
apt-mark hold locales
apt-get install -y --no-install-recommends build-essential postgresql-server-dev-$PG_MAJOR git ca-certificates
mkdir -p build
cd build
git clone https://github.com/pgvector/pgvector.git
cd pgvector
make OPTFLAGS="" && make install
cd ..
git clone https://github.com/citusdata/pg_cron.git
cd pg_cron
make && make install
cd ..
rm -rf build
apt-get install -y /tmp/vectors.deb
rm -f /tmp/vectors.deb
apt-get remove -y build-essential postgresql-server-dev-$PG_MAJOR git
apt-get autoremove -y
apt-mark unhold locales
rm -rf /var/lib/apt/lists/*
EOR

CMD ["postgres", \
"-c", "cron.database_name=${POSTGRES_DB:-postgres}", \
"-c", "shared_preload_libraries=pg_cron,vectors", \
"-c", "search_path=\"$user\",public,vectors", \
"-c", "logging_collector=on"]
46 changes: 0 additions & 46 deletions postgres/build.sh

This file was deleted.

35 changes: 0 additions & 35 deletions postgres/start.sh

This file was deleted.

62 changes: 0 additions & 62 deletions trafficserver/Dockerfile

This file was deleted.

0 comments on commit 942f751

Please sign in to comment.