Skip to content

Commit 3f3a619

Browse files
authored
Merge pull request #548 from sclorg/support_build_test_psql_16
Support building and testing PostgreSQL-16
2 parents 16cd132 + d32d825 commit 3f3a619

28 files changed

+1429
-5
lines changed

.github/workflows/build-and-push.yml

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,20 @@ jobs:
2828
quayio_username: "QUAY_IMAGE_SCLORG_BUILDER_USERNAME"
2929
quayio_token: "QUAY_IMAGE_SCLORG_BUILDER_TOKEN"
3030
docker_context: 15
31+
- dockerfile: "16/Dockerfile.c9s"
32+
registry_namespace: "sclorg"
33+
tag: "c9s"
34+
image_name: "postgresql-16-c9s"
35+
quayio_username: "QUAY_IMAGE_SCLORG_BUILDER_USERNAME"
36+
quayio_token: "QUAY_IMAGE_SCLORG_BUILDER_TOKEN"
37+
docker_context: 16
38+
- dockerfile: "16/Dockerfile.c8s"
39+
registry_namespace: "sclorg"
40+
tag: "c8s"
41+
image_name: "postgresql-16-c8s"
42+
quayio_username: "QUAY_IMAGE_SCLORG_BUILDER_USERNAME"
43+
quayio_token: "QUAY_IMAGE_SCLORG_BUILDER_TOKEN"
44+
docker_context: 16
3145
- dockerfile: "10/Dockerfile.c8s"
3246
registry_namespace: "sclorg"
3347
tag: "c8s"
@@ -84,10 +98,16 @@ jobs:
8498
quayio_token: "QUAY_IMAGE_FEDORA_BUILDER_TOKEN"
8599
image_name: "postgresql-15"
86100
docker_context: 15
87-
101+
- dockerfile: "16/Dockerfile.fedora"
102+
registry_namespace: "fedora"
103+
tag: "16"
104+
quayio_username: "QUAY_IMAGE_FEDORA_BUILDER_USERNAME"
105+
quayio_token: "QUAY_IMAGE_FEDORA_BUILDER_TOKEN"
106+
image_name: "postgresql-16"
107+
docker_context: 16
88108
steps:
89109
- name: check if Dockerfile is c9s, then Build multi arch image and push to quay.io registry
90-
if: matrix.dockerfile == '13/Dockerfile.c9s' || matrix.dockerfile == '15/Dockerfile.c9s'
110+
if: matrix.dockerfile == '13/Dockerfile.c9s' || matrix.dockerfile == '15/Dockerfile.c9s' || matrix.dockerfile == '16/Dockerfile.c9s'
91111
uses: sclorg/build-and-push-action@v4
92112
with:
93113
registry: "quay.io"
@@ -101,7 +121,7 @@ jobs:
101121
archs: amd64, s390x, ppc64le, arm64
102122

103123
- name: Check if Dockerfile is not c9s, then Build and push to quay.io registry
104-
if: matrix.dockerfile != '13/Dockerfile.c9s' && matrix.dockerfile != '15/Dockerfile.c9s'
124+
if: matrix.dockerfile != '13/Dockerfile.c9s' && matrix.dockerfile != '15/Dockerfile.c9s' && matrix.dockerfile != '16/Dockerfile.c9s'
105125
uses: sclorg/build-and-push-action@v4
106126
with:
107127
registry: "quay.io"

16/Dockerfile.c8s

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
FROM quay.io/sclorg/s2i-core-c8s:c8s
2+
3+
# PostgreSQL image for OpenShift.
4+
# Volumes:
5+
# * /var/lib/pgsql/data - Database cluster for PostgreSQL
6+
# Environment:
7+
# * $POSTGRESQL_USER - Database user name
8+
# * $POSTGRESQL_PASSWORD - User's password
9+
# * $POSTGRESQL_DATABASE - Name of the database to create
10+
# * $POSTGRESQL_ADMIN_PASSWORD (Optional) - Password for the 'postgres'
11+
# PostgreSQL administrative account
12+
13+
ENV POSTGRESQL_VERSION=16 \
14+
POSTGRESQL_PREV_VERSION=15 \
15+
HOME=/var/lib/pgsql \
16+
PGUSER=postgres \
17+
APP_DATA=/opt/app-root
18+
19+
ENV SUMMARY="PostgreSQL is an advanced Object-Relational database management system" \
20+
DESCRIPTION="PostgreSQL is an advanced Object-Relational database management system (DBMS). \
21+
The image contains the client and server programs that you'll need to \
22+
create, run, maintain and access a PostgreSQL DBMS server."
23+
24+
LABEL summary="$SUMMARY" \
25+
description="$DESCRIPTION" \
26+
io.k8s.description="$DESCRIPTION" \
27+
io.k8s.display-name="PostgreSQL 16" \
28+
io.openshift.expose-services="5432:postgresql" \
29+
io.openshift.tags="database,postgresql,postgresql16,postgresql-16" \
30+
io.openshift.s2i.assemble-user="26" \
31+
name="sclorg/postgresql-16-c8s" \
32+
com.redhat.component="postgresql-16-container" \
33+
version="1" \
34+
usage="podman run -d --name postgresql_database -e POSTGRESQL_USER=user -e POSTGRESQL_PASSWORD=pass -e POSTGRESQL_DATABASE=db -p 5432:5432 sclorg/postgresql-16-c8s" \
35+
maintainer="SoftwareCollections.org <[email protected]>"
36+
37+
EXPOSE 5432
38+
39+
COPY root/usr/libexec/fix-permissions /usr/libexec/fix-permissions
40+
41+
# This image must forever use UID 26 for postgres user so our volumes are
42+
# safe in the future. This should *never* change, the last test is there
43+
# to make sure of that.
44+
RUN yum -y module enable postgresql:16 && \
45+
INSTALL_PKGS="rsync tar gettext bind-utils nss_wrapper postgresql-server postgresql-contrib" && \
46+
INSTALL_PKGS="$INSTALL_PKGS pgaudit" && \
47+
yum -y --setopt=tsflags=nodocs install $INSTALL_PKGS && \
48+
rpm -V $INSTALL_PKGS && \
49+
postgres -V | grep -qe "$POSTGRESQL_VERSION\." && echo "Found VERSION $POSTGRESQL_VERSION" && \
50+
yum -y reinstall tzdata && \
51+
yum -y clean all --enablerepo='*' && \
52+
localedef -f UTF-8 -i en_US en_US.UTF-8 && \
53+
test "$(id postgres)" = "uid=26(postgres) gid=26(postgres) groups=26(postgres)" && \
54+
mkdir -p /var/lib/pgsql/data && \
55+
/usr/libexec/fix-permissions /var/lib/pgsql /var/run/postgresql
56+
57+
# Get prefix path and path to scripts rather than hard-code them in scripts
58+
ENV CONTAINER_SCRIPTS_PATH=/usr/share/container-scripts/postgresql \
59+
ENABLED_COLLECTIONS=
60+
61+
COPY root /
62+
COPY ./s2i/bin/ $STI_SCRIPTS_PATH
63+
64+
# Not using VOLUME statement since it's not working in OpenShift Online:
65+
# https://github.com/sclorg/httpd-container/issues/30
66+
# VOLUME ["/var/lib/pgsql/data"]
67+
68+
# S2I permission fixes
69+
# --------------------
70+
# 1. unless specified otherwise (or - equivalently - we are in OpenShift), s2i
71+
# build process would be executed as 'uid=26(postgres) gid=26(postgres)'.
72+
# Such process wouldn't be able to execute the default 'assemble' script
73+
# correctly (it transitively executes 'fix-permissions' script). So let's
74+
# add the 'postgres' user into 'root' group here
75+
#
76+
# 2. we call fix-permissions on $APP_DATA here directly (UID=0 during build
77+
# anyways) to assure that s2i process is actually able to _read_ the
78+
# user-specified scripting.
79+
RUN usermod -a -G root postgres && \
80+
/usr/libexec/fix-permissions --read-only "$APP_DATA"
81+
82+
USER 26
83+
84+
ENTRYPOINT ["container-entrypoint"]
85+
CMD ["run-postgresql"]

16/Dockerfile.c9s

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
FROM quay.io/sclorg/s2i-core-c9s:c9s
2+
3+
# PostgreSQL image for OpenShift.
4+
# Volumes:
5+
# * /var/lib/pgsql/data - Database cluster for PostgreSQL
6+
# Environment:
7+
# * $POSTGRESQL_USER - Database user name
8+
# * $POSTGRESQL_PASSWORD - User's password
9+
# * $POSTGRESQL_DATABASE - Name of the database to create
10+
# * $POSTGRESQL_ADMIN_PASSWORD (Optional) - Password for the 'postgres'
11+
# PostgreSQL administrative account
12+
13+
ENV POSTGRESQL_VERSION=16 \
14+
POSTGRESQL_PREV_VERSION=15 \
15+
HOME=/var/lib/pgsql \
16+
PGUSER=postgres \
17+
APP_DATA=/opt/app-root
18+
19+
ENV SUMMARY="PostgreSQL is an advanced Object-Relational database management system" \
20+
DESCRIPTION="PostgreSQL is an advanced Object-Relational database management system (DBMS). \
21+
The image contains the client and server programs that you'll need to \
22+
create, run, maintain and access a PostgreSQL DBMS server."
23+
24+
LABEL summary="$SUMMARY" \
25+
description="$DESCRIPTION" \
26+
io.k8s.description="$DESCRIPTION" \
27+
io.k8s.display-name="PostgreSQL 16" \
28+
io.openshift.expose-services="5432:postgresql" \
29+
io.openshift.tags="database,postgresql,postgresql16,postgresql-16" \
30+
io.openshift.s2i.assemble-user="26" \
31+
name="sclorg/postgresql-16-c9s" \
32+
com.redhat.component="postgresql-16-container" \
33+
version="1" \
34+
usage="podman run -d --name postgresql_database -e POSTGRESQL_USER=user -e POSTGRESQL_PASSWORD=pass -e POSTGRESQL_DATABASE=db -p 5432:5432 sclorg/postgresql-16-c9s" \
35+
maintainer="SoftwareCollections.org <[email protected]>"
36+
37+
EXPOSE 5432
38+
39+
COPY root/usr/libexec/fix-permissions /usr/libexec/fix-permissions
40+
41+
# This image must forever use UID 26 for postgres user so our volumes are
42+
# safe in the future. This should *never* change, the last test is there
43+
# to make sure of that.
44+
RUN { yum -y module enable postgresql:16 || :; } && \
45+
INSTALL_PKGS="rsync tar gettext bind-utils nss_wrapper postgresql-server postgresql-contrib" && \
46+
INSTALL_PKGS="$INSTALL_PKGS pgaudit" && \
47+
yum -y --setopt=tsflags=nodocs install $INSTALL_PKGS && \
48+
rpm -V $INSTALL_PKGS && \
49+
postgres -V | grep -qe "$POSTGRESQL_VERSION\." && echo "Found VERSION $POSTGRESQL_VERSION" && \
50+
yum -y clean all --enablerepo='*' && \
51+
localedef -f UTF-8 -i en_US en_US.UTF-8 && \
52+
test "$(id postgres)" = "uid=26(postgres) gid=26(postgres) groups=26(postgres)" && \
53+
mkdir -p /var/lib/pgsql/data && \
54+
/usr/libexec/fix-permissions /var/lib/pgsql /var/run/postgresql
55+
56+
# Get prefix path and path to scripts rather than hard-code them in scripts
57+
ENV CONTAINER_SCRIPTS_PATH=/usr/share/container-scripts/postgresql \
58+
ENABLED_COLLECTIONS=
59+
60+
COPY root /
61+
COPY ./s2i/bin/ $STI_SCRIPTS_PATH
62+
63+
# Not using VOLUME statement since it's not working in OpenShift Online:
64+
# https://github.com/sclorg/httpd-container/issues/30
65+
# VOLUME ["/var/lib/pgsql/data"]
66+
67+
# S2I permission fixes
68+
# --------------------
69+
# 1. unless specified otherwise (or - equivalently - we are in OpenShift), s2i
70+
# build process would be executed as 'uid=26(postgres) gid=26(postgres)'.
71+
# Such process wouldn't be able to execute the default 'assemble' script
72+
# correctly (it transitively executes 'fix-permissions' script). So let's
73+
# add the 'postgres' user into 'root' group here
74+
#
75+
# 2. we call fix-permissions on $APP_DATA here directly (UID=0 during build
76+
# anyways) to assure that s2i process is actually able to _read_ the
77+
# user-specified scripting.
78+
RUN usermod -a -G root postgres && \
79+
/usr/libexec/fix-permissions --read-only "$APP_DATA"
80+
81+
USER 26
82+
83+
ENTRYPOINT ["container-entrypoint"]
84+
CMD ["run-postgresql"]

16/Dockerfile.fedora

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
FROM quay.io/fedora/s2i-core:39
2+
3+
# PostgreSQL image for OpenShift.
4+
# Volumes:
5+
# * /var/lib/psql/data - Database cluster for PostgreSQL
6+
# Environment:
7+
# * $POSTGRESQL_USER - Database user name
8+
# * $POSTGRESQL_PASSWORD - User's password
9+
# * $POSTGRESQL_DATABASE - Name of the database to create
10+
# * $POSTGRESQL_ADMIN_PASSWORD (Optional) - Password for the 'postgres'
11+
# PostgreSQL administrative account
12+
13+
ENV NAME=postgresql \
14+
VERSION=0 \
15+
ARCH=x86_64 \
16+
\
17+
POSTGRESQL_VERSION=16 \
18+
POSTGRESQL_PREV_VERSION=15 \
19+
HOME=/var/lib/pgsql \
20+
PGUSER=postgres \
21+
APP_DATA=/opt/app-root
22+
23+
ENV SUMMARY="PostgreSQL is an advanced Object-Relational database management system" \
24+
DESCRIPTION="PostgreSQL is an advanced Object-Relational database management system (DBMS). \
25+
The image contains the client and server programs that you'll need to \
26+
create, run, maintain and access a PostgreSQL DBMS server."
27+
28+
LABEL summary="$SUMMARY" \
29+
description="$DESCRIPTION" \
30+
io.k8s.description="$DESCRIPTION" \
31+
io.k8s.display-name="PostgreSQL 16" \
32+
io.openshift.expose-services="5432:postgresql" \
33+
io.openshift.tags="database,postgresql,postgresql16" \
34+
com.redhat.component="$NAME" \
35+
maintainer="SoftwareCollections.org <[email protected]>" \
36+
name="fedora/$NAME-16" \
37+
version="0" \
38+
usage="docker run -d --name postgresql_database -e POSTGRESQL_USER=user -e POSTGRESQL_PASSWORD=pass -e POSTGRESQL_DATABASE=db -p 5432:5432 quay.io/fedora/$NAME-16"
39+
40+
EXPOSE 5432
41+
42+
COPY root/usr/libexec/fix-permissions /usr/libexec/fix-permissions
43+
44+
# This image must forever use UID 26 for postgres user so our volumes are
45+
# safe in the future. This should *never* change, the last test is there
46+
# to make sure of that.
47+
RUN INSTALL_PKGS="rsync tar gettext bind-utils postgresql16-server postgresql16-contrib nss_wrapper " && \
48+
INSTALL_PKGS+="findutils xz" && \
49+
INSTALL_PKGS+=" postgresql16-pgaudit" && \
50+
dnf -y --setopt=tsflags=nodocs install $INSTALL_PKGS && \
51+
rpm -V $INSTALL_PKGS && \
52+
postgres -V | grep -qe "$POSTGRESQL_VERSION\." && echo "Found VERSION $POSTGRESQL_VERSION" && \
53+
dnf clean all && \
54+
test "$(id postgres)" = "uid=26(postgres) gid=26(postgres) groups=26(postgres)" && \
55+
mkdir -p /var/lib/pgsql/data && \
56+
/usr/libexec/fix-permissions /var/lib/pgsql /var/run/postgresql
57+
58+
# Get prefix path and path to scripts rather than hard-code them in scripts
59+
ENV CONTAINER_SCRIPTS_PATH=/usr/share/container-scripts/postgresql
60+
61+
COPY root /
62+
COPY ./s2i/bin/ $STI_SCRIPTS_PATH
63+
64+
VOLUME ["/var/lib/pgsql/data"]
65+
66+
# S2I permission fixes
67+
# --------------------
68+
# 1. unless specified otherwise (or - equivalently - we are in OpenShift), s2i
69+
# build process would be executed as 'uid=26(postgres) gid=26(postgres)'.
70+
# Such process wouldn't be able to execute the default 'assemble' script
71+
# correctly (it transitively executes 'fix-permissions' script). So let's
72+
# add the 'postgres' user into 'root' group here
73+
#
74+
# 2. we call fix-permissions on $APP_DATA here directly (UID=0 during build
75+
# anyways) to assure that s2i process is actually able to _read_ the
76+
# user-specified scripting.
77+
RUN usermod -a -G root postgres && \
78+
/usr/libexec/fix-permissions --read-only "$APP_DATA"
79+
80+
USER 26
81+
82+
ENTRYPOINT ["container-entrypoint"]
83+
CMD ["run-postgresql"]

16/Dockerfile.rhel8

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
FROM ubi8/s2i-core
2+
3+
# PostgreSQL image for OpenShift.
4+
# Volumes:
5+
# * /var/lib/pgsql/data - Database cluster for PostgreSQL
6+
# Environment:
7+
# * $POSTGRESQL_USER - Database user name
8+
# * $POSTGRESQL_PASSWORD - User's password
9+
# * $POSTGRESQL_DATABASE - Name of the database to create
10+
# * $POSTGRESQL_ADMIN_PASSWORD (Optional) - Password for the 'postgres'
11+
# PostgreSQL administrative account
12+
13+
ENV POSTGRESQL_VERSION=16 \
14+
POSTGRESQL_PREV_VERSION=15 \
15+
HOME=/var/lib/pgsql \
16+
PGUSER=postgres \
17+
APP_DATA=/opt/app-root
18+
19+
ENV SUMMARY="PostgreSQL is an advanced Object-Relational database management system" \
20+
DESCRIPTION="PostgreSQL is an advanced Object-Relational database management system (DBMS). \
21+
The image contains the client and server programs that you'll need to \
22+
create, run, maintain and access a PostgreSQL DBMS server."
23+
24+
LABEL summary="$SUMMARY" \
25+
description="$DESCRIPTION" \
26+
io.k8s.description="$DESCRIPTION" \
27+
io.k8s.display-name="PostgreSQL 16" \
28+
io.openshift.expose-services="5432:postgresql" \
29+
io.openshift.tags="database,postgresql,postgresql16,postgresql-16" \
30+
io.openshift.s2i.assemble-user="26" \
31+
name="rhel8/postgresql-16" \
32+
com.redhat.component="postgresql-16-container" \
33+
version="1" \
34+
com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#rhel" \
35+
usage="podman run -d --name postgresql_database -e POSTGRESQL_USER=user -e POSTGRESQL_PASSWORD=pass -e POSTGRESQL_DATABASE=db -p 5432:5432 rhel8/postgresql-16" \
36+
maintainer="SoftwareCollections.org <[email protected]>"
37+
38+
EXPOSE 5432
39+
40+
COPY root/usr/libexec/fix-permissions /usr/libexec/fix-permissions
41+
42+
# This image must forever use UID 26 for postgres user so our volumes are
43+
# safe in the future. This should *never* change, the last test is there
44+
# to make sure of that.
45+
RUN yum -y module enable postgresql:16 && \
46+
INSTALL_PKGS="rsync tar gettext bind-utils nss_wrapper postgresql-server postgresql-contrib" && \
47+
INSTALL_PKGS="$INSTALL_PKGS pgaudit" && \
48+
yum -y --setopt=tsflags=nodocs install $INSTALL_PKGS && \
49+
rpm -V $INSTALL_PKGS && \
50+
postgres -V | grep -qe "$POSTGRESQL_VERSION\." && echo "Found VERSION $POSTGRESQL_VERSION" && \
51+
(yum -y reinstall tzdata || yum -y update tzdata ) && \
52+
yum -y clean all --enablerepo='*' && \
53+
localedef -f UTF-8 -i en_US en_US.UTF-8 && \
54+
test "$(id postgres)" = "uid=26(postgres) gid=26(postgres) groups=26(postgres)" && \
55+
mkdir -p /var/lib/pgsql/data && \
56+
/usr/libexec/fix-permissions /var/lib/pgsql /var/run/postgresql
57+
58+
# Get prefix path and path to scripts rather than hard-code them in scripts
59+
ENV CONTAINER_SCRIPTS_PATH=/usr/share/container-scripts/postgresql \
60+
ENABLED_COLLECTIONS=
61+
62+
COPY root /
63+
COPY ./s2i/bin/ $STI_SCRIPTS_PATH
64+
65+
# Not using VOLUME statement since it's not working in OpenShift Online:
66+
# https://github.com/sclorg/httpd-container/issues/30
67+
# VOLUME ["/var/lib/pgsql/data"]
68+
69+
# S2I permission fixes
70+
# --------------------
71+
# 1. unless specified otherwise (or - equivalently - we are in OpenShift), s2i
72+
# build process would be executed as 'uid=26(postgres) gid=26(postgres)'.
73+
# Such process wouldn't be able to execute the default 'assemble' script
74+
# correctly (it transitively executes 'fix-permissions' script). So let's
75+
# add the 'postgres' user into 'root' group here
76+
#
77+
# 2. we call fix-permissions on $APP_DATA here directly (UID=0 during build
78+
# anyways) to assure that s2i process is actually able to _read_ the
79+
# user-specified scripting.
80+
RUN usermod -a -G root postgres && \
81+
/usr/libexec/fix-permissions --read-only "$APP_DATA"
82+
83+
USER 26
84+
85+
ENTRYPOINT ["container-entrypoint"]
86+
CMD ["run-postgresql"]

0 commit comments

Comments
 (0)