Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions .github/workflows/build-multiarch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Build Multi-Architecture Docker Images

on:
push:
branches:
- master
paths:
- '**/Dockerfile'
- '.github/workflows/build-multiarch.yml'
pull_request:
paths:
- '**/Dockerfile'
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
include:
# Latest versions with pg_tle
- version: 16-3-tle
tags: clkao/postgres-plv8:16-3-tle
- version: 15-3-tle
tags: clkao/postgres-plv8:15-3-tle
- version: 14-3-tle
tags: clkao/postgres-plv8:14-3-tle
- version: 13-3-tle
tags: clkao/postgres-plv8:13-3-tle
- version: 12-2-tle
tags: clkao/postgres-plv8:12-2-tle

# Latest versions (plv8 3.x)
- version: 16-3
tags: clkao/postgres-plv8:16-3,clkao/postgres-plv8:latest
- version: 15-3
tags: clkao/postgres-plv8:15-3
- version: 14-3
tags: clkao/postgres-plv8:14-3
- version: 13-3
tags: clkao/postgres-plv8:13-3

# Older versions (plv8 2.x)
- version: 12-2
tags: clkao/postgres-plv8:12-2
- version: 11-2
tags: clkao/postgres-plv8:11-2
- version: 10-2
tags: clkao/postgres-plv8:10-2
- version: 9.6-2
tags: clkao/postgres-plv8:9.6-2
- version: 9.5-2
tags: clkao/postgres-plv8:9.5-2
- version: 9.4-2
tags: clkao/postgres-plv8:9.4-2

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v5
with:
context: ./${{ matrix.version }}
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ matrix.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max
153 changes: 153 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
name: Release Tagged Docker Images

# This workflow creates Docker Hub tags based on Git tags
# Tag format: vX.Y.Z (e.g., v3.2.4)
# Creates Docker tags like: 16-3.2.4, 15-3.2.4, etc.

on:
push:
tags:
- 'v*.*.*'
workflow_dispatch:
inputs:
version:
description: 'plv8 version (e.g., 3.2.4)'
required: true

jobs:
build-release:
runs-on: ubuntu-latest
strategy:
matrix:
include:
# PostgreSQL 16 variants
- pg_version: "16"
plv8_major: "3"
dockerfile: "16-3"
with_tle: false
- pg_version: "16"
plv8_major: "3"
dockerfile: "16-3-tle"
with_tle: true

# PostgreSQL 15 variants
- pg_version: "15"
plv8_major: "3"
dockerfile: "15-3"
with_tle: false
- pg_version: "15"
plv8_major: "3"
dockerfile: "15-3-tle"
with_tle: true

# PostgreSQL 14 variants
- pg_version: "14"
plv8_major: "3"
dockerfile: "14-3"
with_tle: false
- pg_version: "14"
plv8_major: "3"
dockerfile: "14-3-tle"
with_tle: true

# PostgreSQL 13 variants
- pg_version: "13"
plv8_major: "3"
dockerfile: "13-3"
with_tle: false
- pg_version: "13"
plv8_major: "3"
dockerfile: "13-3-tle"
with_tle: true

# PostgreSQL 12 variants
- pg_version: "12"
plv8_major: "3"
dockerfile: "12-2"
with_tle: false
- pg_version: "12"
plv8_major: "3"
dockerfile: "12-2-tle"
with_tle: true

# PostgreSQL 11
- pg_version: "11"
plv8_major: "3"
dockerfile: "11-2"
with_tle: false

# PostgreSQL 10
- pg_version: "10"
plv8_major: "3"
dockerfile: "10-2"
with_tle: false

# PostgreSQL 9.6
- pg_version: "9.6"
plv8_major: "3"
dockerfile: "9.6-2"
with_tle: false

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Extract version from tag
id: version
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
VERSION="${{ github.event.inputs.version }}"
else
VERSION="${GITHUB_REF#refs/tags/v}"
fi
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Building plv8 version: $VERSION"

- name: Generate Docker tags
id: tags
run: |
VERSION="${{ steps.version.outputs.version }}"
PG="${{ matrix.pg_version }}"
TLE_SUFFIX=""
if [ "${{ matrix.with_tle }}" = "true" ]; then
TLE_SUFFIX="-tle"
fi

# Generate tags
# Example: 16-3.2.4, 16-3.2, 16-3
TAGS="clkao/postgres-plv8:${PG}-${VERSION}${TLE_SUFFIX}"
TAGS="${TAGS},clkao/postgres-plv8:${PG}-$(echo $VERSION | cut -d. -f1,2)${TLE_SUFFIX}"
TAGS="${TAGS},clkao/postgres-plv8:${PG}-$(echo $VERSION | cut -d. -f1)${TLE_SUFFIX}"

# Add latest tag for PostgreSQL 16 without TLE
if [ "${{ matrix.pg_version }}" = "16" ] && [ "${{ matrix.with_tle }}" = "false" ]; then
TAGS="${TAGS},clkao/postgres-plv8:latest"
fi

echo "tags=$TAGS" >> $GITHUB_OUTPUT
echo "Generated tags: $TAGS"

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v5
with:
context: ./${{ matrix.dockerfile }}
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.tags.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max
labels: |
org.opencontainers.image.version=${{ steps.version.outputs.version }}
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
22 changes: 22 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Claude
CLAUDE.local.md

# IDE
.vscode/
.idea/
*.swp
*.swo
*~

# OS
.DS_Store
Thumbs.db

# SQLite databases (now using JSONL as source of truth)
*.db
*.db-journal
*.db-wal
*.db-shm

# Keep JSONL exports (source of truth for git)
!.beads/*.jsonl
11 changes: 7 additions & 4 deletions 10-2/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,25 @@ FROM postgres:10

MAINTAINER Chia-liang Kao <[email protected]>

ENV PLV8_VERSION=2.3.13 \
PLV8_SHASUM="1a96c559d98ad757e7494bf7301f0e6b0dd2eec6066ad76ed36cc13fec4f2390"
ENV PLV8_VERSION=3.2.4 \
PLV8_SHASUM="e05aed3b39851d7a9dc942d4ee229ca6842ce75b47f1c85c5031bc356061d66a"

RUN buildDependencies="build-essential \
ca-certificates \
curl \
git-core \
python \
python3 \
gpp \
cpp \
pkg-config \
apt-transport-https \
cmake \
libc++-dev \
libc++abi-dev \
postgresql-server-dev-$PG_MAJOR" \
runtimeDependencies="libc++1" \
&& runtimeDependencies="libc++1 \
libtinfo5 \
libc++abi1" \
&& apt-get update \
&& apt-get install -y --no-install-recommends ${buildDependencies} ${runtimeDependencies} \
&& mkdir -p /tmp/build \
Expand Down
11 changes: 7 additions & 4 deletions 11-2/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,25 @@ FROM postgres:11

MAINTAINER Chia-liang Kao <[email protected]>

ENV PLV8_VERSION=2.3.13 \
PLV8_SHASUM="1a96c559d98ad757e7494bf7301f0e6b0dd2eec6066ad76ed36cc13fec4f2390"
ENV PLV8_VERSION=3.2.4 \
PLV8_SHASUM="e05aed3b39851d7a9dc942d4ee229ca6842ce75b47f1c85c5031bc356061d66a"

RUN buildDependencies="build-essential \
ca-certificates \
curl \
git-core \
python \
python3 \
gpp \
cpp \
pkg-config \
apt-transport-https \
cmake \
libc++-dev \
libc++abi-dev \
postgresql-server-dev-$PG_MAJOR" \
runtimeDependencies="libc++1" \
&& runtimeDependencies="libc++1 \
libtinfo5 \
libc++abi1" \
&& apt-get update \
&& apt-get install -y --no-install-recommends ${buildDependencies} ${runtimeDependencies} \
&& mkdir -p /tmp/build \
Expand Down
47 changes: 47 additions & 0 deletions 12-2-tle/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
FROM postgres:12

MAINTAINER Chia-liang Kao <[email protected]>

ENV PLV8_VERSION=2.3.13 \
PLV8_SHASUM="1a96c559d98ad757e7494bf7301f0e6b0dd2eec6066ad76ed36cc13fec4f2390"

RUN buildDependencies="build-essential \
ca-certificates \
curl \
git-core \
python \
gpp \
cpp \
pkg-config \
apt-transport-https \
cmake \
libc++-dev \
libc++abi-dev \
postgresql-server-dev-$PG_MAJOR" \
&& runtimeDependencies="libc++1 \
libtinfo5 \
libc++abi1" \
&& apt-get update \
&& apt-get install -y --no-install-recommends ${buildDependencies} ${runtimeDependencies} \
&& mkdir -p /tmp/build \
&& curl -o /tmp/build/v$PLV8_VERSION.tar.gz -SL "https://github.com/plv8/plv8/archive/v${PLV8_VERSION}.tar.gz" \
&& cd /tmp/build \
&& echo $PLV8_SHASUM v$PLV8_VERSION.tar.gz | sha256sum -c \
&& tar -xzf /tmp/build/v$PLV8_VERSION.tar.gz -C /tmp/build/ \
&& cd /tmp/build/plv8-$PLV8_VERSION \
&& make static \
&& make install \
&& strip /usr/lib/postgresql/${PG_MAJOR}/lib/plv8-${PLV8_VERSION}.so \
&& rm -rf /root/.vpython_cipd_cache /root/.vpython-root \
&& cd /tmp/build \
&& git clone https://github.com/aws/pg_tle.git \
&& cd pg_tle \
&& make \
&& make install \
&& apt-get clean \
&& apt-get remove -y ${buildDependencies} \
&& apt-get autoremove -y \
&& rm -rf /tmp/build /var/lib/apt/lists/*

# Configure pg_tle to be loaded on startup
RUN echo "shared_preload_libraries = 'pg_tle'" >> /usr/share/postgresql/postgresql.conf.sample
6 changes: 3 additions & 3 deletions 12-2/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ FROM postgres:12

MAINTAINER Chia-liang Kao <[email protected]>

ENV PLV8_VERSION=2.3.13 \
PLV8_SHASUM="1a96c559d98ad757e7494bf7301f0e6b0dd2eec6066ad76ed36cc13fec4f2390"
ENV PLV8_VERSION=3.2.4 \
PLV8_SHASUM="e05aed3b39851d7a9dc942d4ee229ca6842ce75b47f1c85c5031bc356061d66a"

RUN buildDependencies="build-essential \
ca-certificates \
curl \
git-core \
python \
python3 \
gpp \
cpp \
pkg-config \
Expand Down
Loading