Add custom container image builds [skip ci]

This commit is contained in:
ajp_anton
2026-06-22 22:28:33 +00:00
commit 4b9a91ba7e
6 changed files with 204 additions and 0 deletions
+4
View File
@@ -0,0 +1,4 @@
.git
.gitea
local
README.md
+67
View File
@@ -0,0 +1,67 @@
name: Build custom container images
on:
push:
branches:
- main
workflow_dispatch:
schedule:
- cron: "27 3 * * 1"
permissions:
contents: read
packages: write
env:
REGISTRY: git.ajpanton.se
OWNER: ajp_anton
PG_VERSION: "18"
POSTGIS_VERSION: "3"
VCHORD_VERSION: "0.5.3"
PHP_VERSION: "8"
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
image:
- name: postgres-custom
context: postgres
tags: |
git.ajpanton.se/ajp_anton/postgres-custom:18
git.ajpanton.se/ajp_anton/postgres-custom:18-postgis3-vchord0.5.3
git.ajpanton.se/ajp_anton/postgres-custom:latest
build_args: |
PG_VERSION=18
POSTGIS_VERSION=3
VCHORD_VERSION=0.5.3
- name: php8-pgsql
context: php8-pgsql
tags: |
git.ajpanton.se/ajp_anton/php8-pgsql:8
git.ajpanton.se/ajp_anton/php8-pgsql:8-fpm-alpine
git.ajpanton.se/ajp_anton/php8-pgsql:latest
build_args: |
PHP_VERSION=8
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Gitea container registry
run: |
printf '%s' "$REGISTRY_TOKEN" | docker login "$REGISTRY" --username "$REGISTRY_USERNAME" --password-stdin
- name: Build and push ${{ matrix.image.name }}
uses: docker/build-push-action@v6
with:
context: ./${{ matrix.image.context }}
push: true
tags: ${{ matrix.image.tags }}
build-args: ${{ matrix.image.build_args }}
pull: true
+1
View File
@@ -0,0 +1 @@
local/
+97
View File
@@ -0,0 +1,97 @@
# Custom Container Images
This repository builds a small set of OCI/container images published at
`git.ajpanton.se`.
The images are intended to stay close to their upstream base images while adding
a few commonly useful database/runtime extensions.
## Images
| Image | Description |
| --- | --- |
| `git.ajpanton.se/ajp_anton/postgres-custom:18` | PostgreSQL 18 with selected extension packages installed and `pg_cron`/VectorChord preloaded. |
| `git.ajpanton.se/ajp_anton/php8-pgsql:8` | PHP 8 FPM on Alpine with PostgreSQL client runtime support and the `pdo_pgsql` PHP extension enabled. |
## Included Components
### `postgres-custom`
Base image:
- `postgres:18`
- Moving upstream major-version tag. Patch releases are picked up when the image
is rebuilt.
Installed from Debian/PostgreSQL apt repositories:
- `ca-certificates`
- `wget`
- `postgresql-18-cron`
- `postgresql-18-pgvector`
- `postgresql-18-postgis-3`
Installed from a GitHub release asset:
- VectorChord package `postgresql-18-vchord_0.5.3-1_amd64.deb`
- VectorChord is pinned to `0.5.3` at this time.
Runtime defaults added by this image:
- `shared_preload_libraries=pg_cron,vchord`
- `cron.database_name=firecrawl`
### `php8-pgsql`
Base image:
- `php:8-fpm-alpine`
- Moving upstream major-version tag. Patch releases are picked up when the image
is rebuilt.
Build-time package:
- `postgresql-dev`
Runtime package:
- `libpq`
Compiled PHP extension:
- `pdo_pgsql`
The compiled extension and PHP config are copied from a build stage into the
final runtime image.
## Tags
Moving deployment tags:
- `git.ajpanton.se/ajp_anton/postgres-custom:18`
- `git.ajpanton.se/ajp_anton/php8-pgsql:8`
Descriptive tags:
- `git.ajpanton.se/ajp_anton/postgres-custom:18-postgis3-vchord0.5.3`
- `git.ajpanton.se/ajp_anton/php8-pgsql:8-fpm-alpine`
Convenience tags:
- `git.ajpanton.se/ajp_anton/postgres-custom:latest`
- `git.ajpanton.se/ajp_anton/php8-pgsql:latest`
Tags are mutable. The digest behind a tag may change after a rebuild even when
the tag name stays the same.
## Update Cadence
Images are rebuilt weekly. They may also be rebuilt after repository changes or
manual runs.
Each rebuild pulls the current upstream base image and installs the currently
available apt/apk packages. If the base image or repository packages changed,
the resulting image digest changes and the same tag points to the new image.
Pinned build inputs do not update automatically. In this repository, VectorChord
is pinned to `0.5.3`; changing it requires a repository update.
+14
View File
@@ -0,0 +1,14 @@
ARG PHP_VERSION=8
FROM php:${PHP_VERSION}-fpm-alpine AS build
RUN set -eux; \
apk add --no-cache postgresql-dev; \
docker-php-ext-install pdo_pgsql
FROM php:${PHP_VERSION}-fpm-alpine
RUN set -eux; \
apk add --no-cache libpq
COPY --from=build /usr/local/lib/php/extensions/ /usr/local/lib/php/extensions/
COPY --from=build /usr/local/etc/php/conf.d/ /usr/local/etc/php/conf.d/
+21
View File
@@ -0,0 +1,21 @@
ARG PG_VERSION=18
FROM postgres:${PG_VERSION}
ARG PG_VERSION=18
ARG POSTGIS_VERSION=3
ARG VCHORD_VERSION=0.5.3
RUN set -eux; \
apt-get update; \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
ca-certificates \
wget \
postgresql-${PG_VERSION}-cron \
postgresql-${PG_VERSION}-pgvector \
postgresql-${PG_VERSION}-postgis-${POSTGIS_VERSION}; \
wget -O /tmp/vchord.deb "https://github.com/tensorchord/VectorChord/releases/download/${VCHORD_VERSION}/postgresql-${PG_VERSION}-vchord_${VCHORD_VERSION}-1_amd64.deb"; \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends /tmp/vchord.deb; \
rm -f /tmp/vchord.deb; \
rm -rf /var/lib/apt/lists/*
CMD ["postgres", "-c", "shared_preload_libraries=pg_cron,vchord", "-c", "cron.database_name=firecrawl"]