Skip to content

Commit 4b645f0

Browse files
committed
feat: initial commit
0 parents  commit 4b645f0

File tree

13 files changed

+421
-0
lines changed

13 files changed

+421
-0
lines changed

.conform.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
policies:
3+
- type: commit
4+
spec:
5+
header:
6+
length: 80
7+
imperative: true
8+
case: lower
9+
invalidLastCharacters: .
10+
body:
11+
required: false
12+
dco: false
13+
gpg: false
14+
spellcheck:
15+
locale: US
16+
maximumOfOneCommit: false
17+
conventional:
18+
types:
19+
- refactor
20+
- perf
21+
- chore
22+
- test
23+
- docs
24+
- no_type
25+
scopes:
26+
- release
27+
- deps
28+
- ci
29+
- chart
30+
descriptionLength: 100

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @muhlba91

.github/workflows/release.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
---
2+
name: Release
3+
4+
on:
5+
push:
6+
branches:
7+
- main
8+
9+
permissions:
10+
contents: read
11+
pull-requests: read
12+
13+
jobs:
14+
release:
15+
runs-on: ubuntu-latest
16+
name: Release
17+
outputs:
18+
release_created: ${{ steps.release.outputs.release_created }}
19+
tag_name: ${{ steps.release.outputs.tag_name }}
20+
permissions:
21+
contents: write
22+
pull-requests: write
23+
24+
steps:
25+
- uses: google-github-actions/release-please-action@v4
26+
id: release
27+
28+
container:
29+
if: needs.release.outputs.release_created
30+
runs-on: ubuntu-latest
31+
name: Build (and Push) Container Image
32+
needs:
33+
- release
34+
permissions:
35+
contents: write
36+
packages: write
37+
38+
steps:
39+
- name: Checkout repository
40+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
41+
with:
42+
fetch-depth: 0
43+
token: ${{ secrets.GITHUB_TOKEN }}
44+
45+
- name: Setup QEMU
46+
uses: docker/setup-qemu-action@v3
47+
- name: Setup Docker Buildx
48+
uses: docker/setup-buildx-action@v3
49+
50+
- name: Login to ghcr.io
51+
uses: docker/login-action@v3
52+
with:
53+
registry: ghcr.io
54+
username: ${{ github.actor }}
55+
password: ${{ secrets.GITHUB_TOKEN }}
56+
57+
- name: Get Upstream Tags
58+
id: from_tag
59+
run: |
60+
POSTGRESQL_IMAGE=$(cat Dockerfile | grep 'FROM ghcr.io/cloudnative-pg/postgresql:')
61+
POSTGRESQL_FROM_TAG=$(echo $POSTGRESQL_IMAGE | cut -d':' -f2)
62+
echo "postgresql=${POSTGRESQL_FROM_TAG}" >> "$GITHUB_OUTPUT"
63+
PGVECTO_IMAGE=$(cat Dockerfile | grep 'FROM tensorchord/pgvecto-rs-binary:')
64+
PGVECTO_FROM_TAG=$(echo $PGVECTO_IMAGE | cut -d'-' -f4)
65+
echo "pgvecto=${PGVECTO_FROM_TAG}" >> "$GITHUB_OUTPUT"
66+
67+
- name: Build and Push Image
68+
uses: docker/build-push-action@v5
69+
with:
70+
context: .
71+
platforms: linux/amd64,linux/arm64
72+
push: true
73+
tags: |
74+
ghcr.io/muhlba91/postgresql-pgvecto:latest
75+
ghcr.io/muhlba91/postgresql-pgvecto:${{ github.sha }}
76+
ghcr.io/muhlba91/postgresql-pgvecto:${{ steps.from_tag.outputs.postgresql }}-${{ steps.from_tag.outputs.pgvecto }}-${{ needs.release.outputs.tag_name }}
77+
build-args: |
78+
CI_COMMIT_TIMESTAMP=${{ github.event.repository.updated_at }}
79+
CI_COMMIT_SHA=${{ github.sha }}
80+
CI_COMMIT_TAG=${{ steps.from_tag.outputs.postgresql }}-${{ steps.from_tag.outputs.pgvecto }}-${{ needs.release.outputs.tag_name }}
81+
CI_UPSTREAM_VERSION=${{ steps.from_tag.outputs.postgresql }}-${{ steps.from_tag.outputs.pgvecto }}

.github/workflows/verify.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
---
2+
name: Verify
3+
4+
on:
5+
push:
6+
branches:
7+
- main
8+
pull_request:
9+
workflow_dispatch:
10+
11+
jobs:
12+
conform:
13+
runs-on: ubuntu-latest
14+
name: Conform
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
- uses: siderolabs/conform@v0.1.0-alpha.27
22+
with:
23+
token: ${{ secrets.GITHUB_TOKEN }}
24+
25+
lint:
26+
runs-on: ubuntu-latest
27+
name: Lint Dockerfile
28+
29+
steps:
30+
- name: Checkout repository
31+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
32+
with:
33+
fetch-depth: 0
34+
35+
- name: Lint Dockerfile
36+
uses: hadolint/hadolint-action@v3.1.0
37+
with:
38+
dockerfile: Dockerfile
39+
40+
container:
41+
runs-on: ubuntu-latest
42+
name: Build Container Image
43+
44+
steps:
45+
- name: Checkout repository
46+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
47+
with:
48+
fetch-depth: 0
49+
token: ${{ secrets.GITHUB_TOKEN }}
50+
51+
- name: Setup QEMU
52+
uses: docker/setup-qemu-action@v3
53+
- name: Setup Docker Buildx
54+
uses: docker/setup-buildx-action@v3
55+
56+
- name: Get Upstream Tags
57+
id: from_tag
58+
run: |
59+
POSTGRESQL_IMAGE=$(cat Dockerfile | grep 'FROM ghcr.io/cloudnative-pg/postgresql:')
60+
POSTGRESQL_FROM_TAG=$(echo $POSTGRESQL_IMAGE | cut -d':' -f2)
61+
echo "postgresql=${POSTGRESQL_FROM_TAG}" >> "$GITHUB_OUTPUT"
62+
PGVECTO_IMAGE=$(cat Dockerfile | grep 'FROM tensorchord/pgvecto-rs-binary:')
63+
PGVECTO_FROM_TAG=$(echo $PGVECTO_IMAGE | cut -d'-' -f4)
64+
echo "pgvecto=${PGVECTO_FROM_TAG}" >> "$GITHUB_OUTPUT"
65+
66+
- name: Build Image
67+
uses: docker/build-push-action@v5
68+
with:
69+
context: .
70+
platforms: linux/amd64,linux/arm64
71+
push: false
72+
tags: |
73+
ghcr.io/muhlba91/postgresql-pgvecto:latest
74+
ghcr.io/muhlba91/postgresql-pgvecto:${{ github.sha }}
75+
build-args: |
76+
CI_COMMIT_TIMESTAMP=${{ github.event.repository.updated_at }}
77+
CI_COMMIT_SHA=${{ github.sha }}
78+
CI_COMMIT_TAG=latest
79+
CI_UPSTREAM_VERSION=${{ steps.from_tag.outputs.postgresql }}-${{ steps.from_tag.outputs.pgvecto }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
release-CHANGELOG.md

.hadolint.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
ignored:
3+
- DL3018 # we don't install non-common tools and need to pin version on apk add

.pre-commit-config.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
repos:
3+
- repo: https://github.com/talos-systems/conform
4+
rev: v0.1.0-alpha.30
5+
hooks:
6+
- id: conform
7+
stages:
8+
- commit-msg
9+
- repo: https://github.com/hadolint/hadolint
10+
rev: v2.13.0-beta
11+
hooks:
12+
- id: hadolint
13+
- repo: https://github.com/pre-commit/pre-commit-hooks
14+
rev: v4.6.0
15+
hooks:
16+
- id: check-json
17+
- id: check-merge-conflict
18+
- id: check-symlinks
19+
- id: check-toml
20+
- id: check-xml
21+
- id: check-yaml
22+
args: [
23+
"--unsafe"
24+
]
25+
- id: detect-aws-credentials
26+
args: [
27+
"--allow-missing-credentials"
28+
]
29+
- id: detect-private-key
30+
# - id: no-commit-to-branch
31+
# args: [
32+
# "--branch",
33+
# "main",
34+
# "--branch",
35+
# "next"
36+
# ]

.release-please-manifest.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
".": "1.0.0"
3+
}

Dockerfile

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
ARG CI_COMMIT_TIMESTAMP
2+
ARG CI_COMMIT_SHA
3+
ARG CI_COMMIT_TAG
4+
ARG CI_UPSTREAM_VERSION
5+
6+
# pgvecto.rs binary container
7+
FROM tensorchord/pgvecto-rs-binary:pg15-v0.2.1-${TARGETARCH} as binary
8+
9+
# main container
10+
FROM ghcr.io/cloudnative-pg/postgresql:15.6-16
11+
12+
LABEL org.opencontainers.image.authors="Daniel Muehlbachler-Pietrzykowski <daniel.muehlbachler@niftyside.com>"
13+
LABEL org.opencontainers.image.vendor="Daniel Muehlbachler-Pietrzykowski"
14+
LABEL org.opencontainers.image.source="https://github.com/muhlba91/postgresql-pgvecto-container"
15+
LABEL org.opencontainers.image.created="${CI_COMMIT_TIMESTAMP}"
16+
LABEL org.opencontainers.image.title="postgresql-pgvecto"
17+
LABEL org.opencontainers.image.description="A container integrating pgvecto.rs into CloudNativePG PostgreSQL"
18+
LABEL org.opencontainers.image.revision="${CI_COMMIT_SHA}"
19+
LABEL org.opencontainers.image.version="${CI_COMMIT_TAG}"
20+
LABEL org.opencontainers.image.upstream="${CI_UPSTREAM_VERSION}"
21+
22+
USER root
23+
# taken from https://github.com/tensorchord/pgvecto.rs/
24+
COPY --from=binary /pgvecto-rs-binary-release.deb /tmp/vectors.deb
25+
RUN apt-get install --yes --no-install-recommends /tmp/vectors.deb && rm -f /tmp/vectors.deb
26+
USER 26
27+
28+
CMD ["postgres", "-c" ,"shared_preload_libraries=vectors.so", "-c", "search_path=\"$user\", public, vectors", "-c", "logging_collector=on"]

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2022 Daniel Muehlbachler-Pietrzykowski
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)