chore: add jit package conditionally to standard images (#311)

Ensure recommended PostgreSQL packages are included in the  
`standard` image only when required by the version. Starting  
with PostgreSQL 18, the PGDG Debian packages split `jit` into  
its own package, so it needs to be added separately.

Closes #288

Signed-off-by: Gabriele Bartolini <gabriele.bartolini@enterprisedb.com>
Signed-off-by: Niccolò Fei <niccolo.fei@enterprisedb.com>
Co-authored-by: Niccolò Fei <niccolo.fei@enterprisedb.com>
This commit is contained in:
Gabriele Bartolini
2025-09-15 14:14:23 +02:00
committed by GitHub
parent 796423b54a
commit 2d1054c8f0
2 changed files with 15 additions and 1 deletions

View File

@@ -22,9 +22,10 @@ USER 26
FROM minimal AS standard
ARG EXTENSIONS
ARG STANDARD_ADDITIONAL_POSTGRES_PACKAGES
USER root
RUN apt-get update && \
apt-get install -y --no-install-recommends locales-all ${EXTENSIONS} && \
apt-get install -y --no-install-recommends locales-all ${STANDARD_ADDITIONAL_POSTGRES_PACKAGES} ${EXTENSIONS} && \
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false && \
rm -rf /var/lib/apt/lists/* /var/cache/* /var/log/*

View File

@@ -40,6 +40,7 @@ postgreSQLPreviewVersions = [
# renovate: datasource=github-releases depName=EnterpriseDB/barman versioning=loose
barmanVersion = "3.14.0"
// Extensions to be included in the `standard` image
extensions = [
"pgaudit",
"pgvector",
@@ -82,6 +83,7 @@ target "default" {
PG_MAJOR = "${getMajor(pgVersion)}"
BASE = "${base}"
EXTENSIONS = "${getExtensionsString(pgVersion, extensions)}"
STANDARD_ADDITIONAL_POSTGRES_PACKAGES = "${getStandardAdditionalPostgresPackagesPerMajorVersion(getMajor(pgVersion))}"
BARMAN_VERSION = "${barmanVersion}"
}
attest = [
@@ -155,6 +157,17 @@ function getExtensionsString {
result = (isPreview(version) == true) ? "" : join(" ", formatlist("postgresql-%s-%s", getMajor(version), extensions))
}
// This function conditionally adds recommended PostgreSQL packages based on
// the version. For example, starting with version 18, PGDG moved `jit` out of
// the main package and into a separate one.
function getStandardAdditionalPostgresPackagesPerMajorVersion {
params = [ majorVersion ]
// Add PostgreSQL jit package from version 18
result = join(" ", [
majorVersion < 18 ? "" : format("postgresql-%s-jit", majorVersion)
])
}
function isMajorPresent {
params = [major, pgVersions]
result = contains([for v in pgVersions : getMajor(v)], major)