Skip to content

Commit 2d1054c

Browse files
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>
1 parent 796423b commit 2d1054c

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@ USER 26
2222

2323
FROM minimal AS standard
2424
ARG EXTENSIONS
25+
ARG STANDARD_ADDITIONAL_POSTGRES_PACKAGES
2526
USER root
2627
RUN apt-get update && \
27-
apt-get install -y --no-install-recommends locales-all ${EXTENSIONS} && \
28+
apt-get install -y --no-install-recommends locales-all ${STANDARD_ADDITIONAL_POSTGRES_PACKAGES} ${EXTENSIONS} && \
2829
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false && \
2930
rm -rf /var/lib/apt/lists/* /var/cache/* /var/log/*
3031

docker-bake.hcl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ postgreSQLPreviewVersions = [
4040
# renovate: datasource=github-releases depName=EnterpriseDB/barman versioning=loose
4141
barmanVersion = "3.14.0"
4242

43+
// Extensions to be included in the `standard` image
4344
extensions = [
4445
"pgaudit",
4546
"pgvector",
@@ -82,6 +83,7 @@ target "default" {
8283
PG_MAJOR = "${getMajor(pgVersion)}"
8384
BASE = "${base}"
8485
EXTENSIONS = "${getExtensionsString(pgVersion, extensions)}"
86+
STANDARD_ADDITIONAL_POSTGRES_PACKAGES = "${getStandardAdditionalPostgresPackagesPerMajorVersion(getMajor(pgVersion))}"
8587
BARMAN_VERSION = "${barmanVersion}"
8688
}
8789
attest = [
@@ -155,6 +157,17 @@ function getExtensionsString {
155157
result = (isPreview(version) == true) ? "" : join(" ", formatlist("postgresql-%s-%s", getMajor(version), extensions))
156158
}
157159

160+
// This function conditionally adds recommended PostgreSQL packages based on
161+
// the version. For example, starting with version 18, PGDG moved `jit` out of
162+
// the main package and into a separate one.
163+
function getStandardAdditionalPostgresPackagesPerMajorVersion {
164+
params = [ majorVersion ]
165+
// Add PostgreSQL jit package from version 18
166+
result = join(" ", [
167+
majorVersion < 18 ? "" : format("postgresql-%s-jit", majorVersion)
168+
])
169+
}
170+
158171
function isMajorPresent {
159172
params = [major, pgVersions]
160173
result = contains([for v in pgVersions : getMajor(v)], major)

0 commit comments

Comments
 (0)