forked from repo-mirrors/cnpg-postgres-containers
chore: add support for PostgreSQL beta versions (#191)
Now bake supports beta versions for the list and the building of the images Closes #190 Signed-off-by: Jonathan Gonzalez V <jonathan.gonzalez@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:
committed by
GitHub
parent
b1421da867
commit
23e1fa6181
11
Dockerfile
11
Dockerfile
@@ -2,13 +2,13 @@ ARG BASE=debian:12.11-slim
|
|||||||
FROM $BASE AS minimal
|
FROM $BASE AS minimal
|
||||||
|
|
||||||
ARG PG_VERSION
|
ARG PG_VERSION
|
||||||
ARG PG_MAJOR=${PG_VERSION%%.*}
|
ARG PG_MAJOR
|
||||||
|
|
||||||
ENV PATH=$PATH:/usr/lib/postgresql/$PG_MAJOR/bin
|
ENV PATH=$PATH:/usr/lib/postgresql/$PG_MAJOR/bin
|
||||||
|
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
apt-get install -y --no-install-recommends postgresql-common ca-certificates gnupg && \
|
apt-get install -y --no-install-recommends postgresql-common ca-certificates gnupg && \
|
||||||
/usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -y && \
|
/usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -y -c "${PG_MAJOR}" && \
|
||||||
apt-get install -y --no-install-recommends -o Dpkg::::="--force-confdef" -o Dpkg::::="--force-confold" postgresql-common && \
|
apt-get install -y --no-install-recommends -o Dpkg::::="--force-confdef" -o Dpkg::::="--force-confold" postgresql-common && \
|
||||||
sed -ri 's/#(create_main_cluster) .*$/\1 = false/' /etc/postgresql-common/createcluster.conf && \
|
sed -ri 's/#(create_main_cluster) .*$/\1 = false/' /etc/postgresql-common/createcluster.conf && \
|
||||||
apt-get install -y --no-install-recommends \
|
apt-get install -y --no-install-recommends \
|
||||||
@@ -21,13 +21,10 @@ USER 26
|
|||||||
|
|
||||||
|
|
||||||
FROM minimal AS standard
|
FROM minimal AS standard
|
||||||
|
ARG EXTENSIONS
|
||||||
USER root
|
USER root
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
apt-get install -y --no-install-recommends locales-all \
|
apt-get install -y --no-install-recommends locales-all ${EXTENSIONS} && \
|
||||||
"postgresql-${PG_MAJOR}-pgaudit" \
|
|
||||||
"postgresql-${PG_MAJOR}-pgvector" \
|
|
||||||
"postgresql-${PG_MAJOR}-pg-failover-slots" && \
|
|
||||||
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false && \
|
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false && \
|
||||||
rm -rf /var/lib/apt/lists/* /var/cache/* /var/log/*
|
rm -rf /var/lib/apt/lists/* /var/cache/* /var/log/*
|
||||||
|
|
||||||
|
@@ -20,6 +20,12 @@ now = timestamp()
|
|||||||
authors = "The CloudNativePG Contributors"
|
authors = "The CloudNativePG Contributors"
|
||||||
url = "https://github.com/cloudnative-pg/postgres-containers"
|
url = "https://github.com/cloudnative-pg/postgres-containers"
|
||||||
|
|
||||||
|
extensions = [
|
||||||
|
"pgaudit",
|
||||||
|
"pgvector",
|
||||||
|
"pg-failover-slots"
|
||||||
|
]
|
||||||
|
|
||||||
target "default" {
|
target "default" {
|
||||||
matrix = {
|
matrix = {
|
||||||
tgt = [
|
tgt = [
|
||||||
@@ -31,7 +37,8 @@ target "default" {
|
|||||||
"14.18",
|
"14.18",
|
||||||
"15.13",
|
"15.13",
|
||||||
"16.9",
|
"16.9",
|
||||||
"17.5"
|
"17.5",
|
||||||
|
"18~beta1"
|
||||||
]
|
]
|
||||||
base = [
|
base = [
|
||||||
// renovate: datasource=docker versioning=loose
|
// renovate: datasource=docker versioning=loose
|
||||||
@@ -45,17 +52,19 @@ target "default" {
|
|||||||
"linux/arm64"
|
"linux/arm64"
|
||||||
]
|
]
|
||||||
dockerfile = "Dockerfile"
|
dockerfile = "Dockerfile"
|
||||||
name = "postgresql-${index(split(".",pgVersion),0)}-${tgt}-${distroVersion(base)}"
|
name = "postgresql-${index(split(".",cleanVersion(pgVersion)),0)}-${tgt}-${distroVersion(base)}"
|
||||||
tags = [
|
tags = [
|
||||||
"${fullname}:${index(split(".",pgVersion),0)}-${tgt}-${distroVersion(base)}",
|
"${fullname}:${index(split(".",cleanVersion(pgVersion)),0)}-${tgt}-${distroVersion(base)}",
|
||||||
"${fullname}:${pgVersion}-${tgt}-${distroVersion(base)}",
|
"${fullname}:${cleanVersion(pgVersion)}-${tgt}-${distroVersion(base)}",
|
||||||
"${fullname}:${pgVersion}-${formatdate("YYYYMMDDhhmm", now)}-${tgt}-${distroVersion(base)}"
|
"${fullname}:${cleanVersion(pgVersion)}-${formatdate("YYYYMMDDhhmm", now)}-${tgt}-${distroVersion(base)}"
|
||||||
]
|
]
|
||||||
context = "."
|
context = "."
|
||||||
target = "${tgt}"
|
target = "${tgt}"
|
||||||
args = {
|
args = {
|
||||||
PG_VERSION = "${pgVersion}"
|
PG_VERSION = "${pgVersion}"
|
||||||
|
PG_MAJOR = "${getMajor(pgVersion)}"
|
||||||
BASE = "${base}"
|
BASE = "${base}"
|
||||||
|
EXTENSIONS = "${getExtensionsString(pgVersion, extensions)}"
|
||||||
}
|
}
|
||||||
attest = [
|
attest = [
|
||||||
"type=provenance,mode=max",
|
"type=provenance,mode=max",
|
||||||
@@ -107,3 +116,23 @@ function digest {
|
|||||||
params = [ imageNameWithSha ]
|
params = [ imageNameWithSha ]
|
||||||
result = index(split("@", imageNameWithSha), 1)
|
result = index(split("@", imageNameWithSha), 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function cleanVersion {
|
||||||
|
params = [ version ]
|
||||||
|
result = replace(version, "~", "")
|
||||||
|
}
|
||||||
|
|
||||||
|
function isBeta {
|
||||||
|
params = [ version ]
|
||||||
|
result = length(regexall("[0-9]+~beta.*", version)) > 0
|
||||||
|
}
|
||||||
|
|
||||||
|
function getMajor {
|
||||||
|
params = [ version ]
|
||||||
|
result = (isBeta(version) == true) ? index(split("~", version),0) : index(split(".", version),0)
|
||||||
|
}
|
||||||
|
|
||||||
|
function getExtensionsString {
|
||||||
|
params = [ version, extensions ]
|
||||||
|
result = (isBeta(version) == true) ? "" : join(" ", formatlist("postgresql-%s-%s", getMajor(version), extensions))
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user