From 4b9a91ba7ec092d58832a8e24351794fbcb8bf49 Mon Sep 17 00:00:00 2001 From: ajp_anton Date: Mon, 22 Jun 2026 22:07:53 +0000 Subject: [PATCH] Add custom container image builds [skip ci] --- .dockerignore | 4 ++ .gitea/workflows/build-images.yaml | 67 +++++++++++++++++++++ .gitignore | 1 + README.md | 97 ++++++++++++++++++++++++++++++ php8-pgsql/Dockerfile | 14 +++++ postgres/Dockerfile | 21 +++++++ 6 files changed, 204 insertions(+) create mode 100644 .dockerignore create mode 100644 .gitea/workflows/build-images.yaml create mode 100644 .gitignore create mode 100644 README.md create mode 100644 php8-pgsql/Dockerfile create mode 100644 postgres/Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..b0eb7b5 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +.git +.gitea +local +README.md diff --git a/.gitea/workflows/build-images.yaml b/.gitea/workflows/build-images.yaml new file mode 100644 index 0000000..5630817 --- /dev/null +++ b/.gitea/workflows/build-images.yaml @@ -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 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..51b4cfd --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +local/ diff --git a/README.md b/README.md new file mode 100644 index 0000000..003b551 --- /dev/null +++ b/README.md @@ -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. diff --git a/php8-pgsql/Dockerfile b/php8-pgsql/Dockerfile new file mode 100644 index 0000000..1327770 --- /dev/null +++ b/php8-pgsql/Dockerfile @@ -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/ diff --git a/postgres/Dockerfile b/postgres/Dockerfile new file mode 100644 index 0000000..d97a80e --- /dev/null +++ b/postgres/Dockerfile @@ -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"]