prole/pg-knoe-auth/Dockerfile
chrisfu 57886f9268 feat(pg-knoe-auth): import upstream PostgreSQL JWT auth extension; compile in knoe-db image
- Copy pg-knoe-auth/ wholesale from upstream/knoe-db/20260523 (Task 1 of
  docs/plans/junie/upstream-knoe-db-20260523-integration.md).
- Extension: PG18 OAUTHBEARER JWT validator using libcurl + OpenSSL RS256.
- knoe-db/Dockerfile: add libcurl4-openssl-dev to dev deps; COPY src/ and
  build with make USE_PGXS=1 install after tds_fdw.
- NOT enabled in the default database build (absent from 20_create_extensions.sh).
  To enable: CREATE EXTENSION pg_knoe_auth; (requires pg_hba.conf oauth_issuer).

Closes Task 1 of upstream-knoe-db-20260523-integration.md.
2026-05-23 21:52:06 -07:00

45 lines
1.6 KiB
Docker

# syntax=docker/dockerfile:1.4
# pg-knoe-auth builder image
#
# Produces a scratch artifact image containing only pg_knoe_auth.so and its
# SHA256 checksum. The knoe-db Dockerfile consumes it via COPY --from=.
#
# Build:
# docker build -t pg-knoe-auth:local .
#
# See docs/plans/junie/pg_knoe_auth-rename-harden-modularize.md §2.3
FROM ubuntu:24.04 AS builder
ARG PG_MAJOR=18
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates curl wget gnupg2 lsb-release \
build-essential pkg-config \
libcurl4-openssl-dev libssl-dev libkrb5-dev \
&& rm -rf /var/lib/apt/lists/*
# Install Percona PG18 server-dev for pg_config + headers
RUN wget -q "https://repo.percona.com/apt/percona-release_latest.$(lsb_release -sc)_all.deb" \
&& dpkg -i "percona-release_latest.$(lsb_release -sc)_all.deb" \
&& rm "percona-release_latest.$(lsb_release -sc)_all.deb" \
&& percona-release setup ppg-${PG_MAJOR} \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
percona-postgresql-${PG_MAJOR} \
percona-postgresql-server-dev-${PG_MAJOR} \
&& rm -rf /var/lib/apt/lists/*
COPY src/ /build/src/
WORKDIR /build/src
RUN make USE_PGXS=1 PG_CONFIG=/usr/lib/postgresql/${PG_MAJOR}/bin/pg_config
# Copy artifact + checksum to /output
RUN mkdir -p /output && \
cp pg_knoe_auth.so /output/ && \
sha256sum /output/pg_knoe_auth.so > /output/pg_knoe_auth.so.sha256
# Final stage: just the artifact (importable via COPY --from=)
FROM scratch AS artifact
COPY --from=builder /output/ /output/