Files
sso-manager-node/.github/workflows/build-openldap-image.yml
T
wmantly c30975329c feat: publish a prebuilt OpenLDAP-with-nestgroup base image (#187)
Extracts Dockerfile.openldap's `ldapbuild` stage (compile OpenLDAP from
source for the nestgroup overlay, ~5 min, dependent on git.openldap.org
being reachable) into its own Dockerfile, built and pushed to
ghcr.io/theta42/openldap-nestgroup by this workflow whenever the pinned
commit changes.

This commit only adds the new image + workflow; Dockerfile.openldap itself
still compiles from source. A follow-up change switches it to FROM the
published image once this workflow has run once and the image exists.

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-09 16:54:36 -07:00

59 lines
1.9 KiB
YAML

name: Build OpenLDAP Base Image
# Publishes ghcr.io/theta42/openldap-nestgroup, the prebuilt slapd-with-
# nestgroup image Dockerfile.openldap's `ldapbuild` stage pulls FROM instead
# of compiling from source on every build (see Dockerfile.openldap-builder
# for why, and the ~5 minute + git.openldap.org-dependent cost it replaces).
#
# Runs only when the builder Dockerfile changes -- bumping OPENLDAP_COMMIT in
# it is the only reason this image should ever need rebuilding -- or on
# manual dispatch.
on:
push:
branches: [master]
paths:
- 'Dockerfile.openldap-builder'
- '.github/workflows/build-openldap-image.yml'
workflow_dispatch: {}
permissions:
contents: read
packages: write
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Single source of truth for the tag: the ARG default in the Dockerfile
# itself, not a value duplicated into this workflow.
- name: Resolve pinned OpenLDAP commit
id: commit
run: |
commit=$(grep -oP '^ARG OPENLDAP_COMMIT=\K[0-9a-f]+' Dockerfile.openldap-builder)
if [ -z "$commit" ]; then
echo "::error::Could not resolve OPENLDAP_COMMIT from Dockerfile.openldap-builder"
exit 1
fi
echo "commit=$commit" >> "$GITHUB_OUTPUT"
- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile.openldap-builder
build-args: |
OPENLDAP_COMMIT=${{ steps.commit.outputs.commit }}
push: true
tags: |
ghcr.io/theta42/openldap-nestgroup:${{ steps.commit.outputs.commit }}
ghcr.io/theta42/openldap-nestgroup:latest