Skip to content

Commit 5585bbc

Browse files
author
SUSE Update Bot
committed
Test build for #2777
1 parent 50481ef commit 5585bbc

File tree

10 files changed

+458
-6
lines changed

10 files changed

+458
-6
lines changed

.obs/workflows.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,14 @@ staging_build:
9797
source_project: home:pushman:BCI:CR:16.0
9898
source_package: postgres-16-image
9999
target_project: home:pushman:BCI:CR:16.0:Staging
100+
- branch_package:
101+
source_project: home:pushman:BCI:CR:16.0
102+
source_package: postgres-16-image
103+
target_project: home:pushman:BCI:CR:16.0:Staging
104+
- branch_package:
105+
source_project: home:pushman:BCI:CR:16.0
106+
source_package: postgres-17-image
107+
target_project: home:pushman:BCI:CR:16.0:Staging
100108
- branch_package:
101109
source_project: home:pushman:BCI:CR:16.0
102110
source_package: postgres-17-image
@@ -230,6 +238,12 @@ refresh_devel_BCI:
230238
- trigger_services:
231239
project: devel:BCI:16.0
232240
package: postgres-16-image
241+
- trigger_services:
242+
project: devel:BCI:16.0
243+
package: postgres-16-image
244+
- trigger_services:
245+
project: devel:BCI:16.0
246+
package: postgres-17-image
233247
- trigger_services:
234248
project: devel:BCI:16.0
235249
package: postgres-17-image

postgres-16-image/Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# SPDX-License-Identifier: PostgreSQL
1+
#!ExclusiveArch: do-not-build
2+
#!ForceMultiVersion
23

3-
# Copyright (c) 2025 SUSE LLC
4-
5-
# All modifications and additions to the file contributed by third parties
4+
# For this container we only build the Dockerfile.$flavor builds.
5+
le contributed by third parties
66
# remain the property of their copyright owners, unless otherwise agreed
77
# upon.
88

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# SPDX-License-Identifier: PostgreSQL
2+
3+
# Copyright (c) 2025 SUSE LLC
4+
5+
# All modifications and additions to the file contributed by third parties
6+
# remain the property of their copyright owners, unless otherwise agreed
7+
# upon.
8+
9+
# The content of THIS FILE IS AUTOGENERATED and should not be manually modified.
10+
# It is maintained by the BCI team and generated by
11+
# https://github.com/SUSE/BCI-dockerfile-generator
12+
13+
# Please submit bugfixes or comments via https://bugs.opensuse.org/
14+
# You can contact the BCI team via https://github.com/SUSE/bci/discussions
15+
16+
#!UseOBSRepositories
17+
18+
#!BuildTag: suse/postgres:%%pg_patch_version%%-contrib-%RELEASE%
19+
#!BuildTag: suse/postgres:%%pg_patch_version%%-contrib
20+
#!BuildTag: suse/postgres:16-contrib
21+
#!BuildTag: suse/postgres:%%pg_minor_version%%
22+
#!BcntSyncTag: postgres-16-image
23+
#!BuildName: suse-postgres-16-contrib
24+
#!BuildVersion: 16.0.16
25+
FROM bci/bci-micro:16.0 AS target
26+
FROM bci/bci-base:16.0 AS builder
27+
COPY --from=target / /target
28+
29+
RUN set -euo pipefail; \
30+
zypper -n --installroot /target --gpg-auto-import-keys install --no-recommends libpq5 postgresql16-server findutils coreutils sed util-linux postgresql16-contrib postgresql16-pgvector
31+
RUN set -euo pipefail; zypper -n --installroot /target clean -a; \
32+
rm -rf {/target,}/var/log/{alternatives.log,lastlog,tallylog,zypper.log,zypp/history,YaST2}
33+
FROM bci/bci-micro:16.0
34+
COPY --from=builder /target /
35+
# Define labels according to https://en.opensuse.org/Building_derived_containers
36+
# labelprefix=com.suse.application.postgres
37+
LABEL org.opencontainers.image.authors="https://github.com/SUSE/bci/discussions"
38+
LABEL org.opencontainers.image.title="SLE PostgreSQL 16"
39+
LABEL org.opencontainers.image.description="PostgreSQL 16 container based on the SLE Base Container Image."
40+
LABEL org.opencontainers.image.version="%%pg_patch_version%%"
41+
LABEL org.opencontainers.image.url="https://www.suse.com/products/base-container-images/"
42+
LABEL org.opencontainers.image.created="%BUILDTIME%"
43+
LABEL org.opencontainers.image.vendor="SUSE LLC"
44+
LABEL org.opencontainers.image.source="%SOURCEURL%"
45+
LABEL org.opencontainers.image.ref.name="%%pg_patch_version%%-contrib-%RELEASE%"
46+
LABEL org.opensuse.reference="registry.suse.com/suse/postgres:%%pg_patch_version%%-contrib-%RELEASE%"
47+
LABEL org.openbuildservice.disturl="%DISTURL%"
48+
LABEL com.suse.supportlevel="acc"
49+
LABEL com.suse.eula="sle-eula"
50+
LABEL com.suse.lifecycle-url="https://www.suse.com/lifecycle"
51+
LABEL com.suse.release-stage="beta"
52+
# endlabelprefix
53+
LABEL io.artifacthub.package.readme-url="%SOURCEURL_WITH(README.contrib.md)%"
54+
ENV LANG="en_US.utf8"
55+
ENV PGDATA="/var/lib/pgsql/data"
56+
ENV PG_MAJOR="16"
57+
ENV PG_VERSION="%%pg_minor_version%%"
58+
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
59+
CMD ["postgres"]
60+
EXPOSE 5432/tcp
61+
COPY docker-entrypoint.sh /usr/local/bin/
62+
RUN set -euo pipefail; chmod +x /usr/local/bin/docker-entrypoint.sh; \
63+
sed -i -e 's/exec gosu postgres "/exec setpriv --reuid=postgres --regid=postgres --clear-groups -- "/g' /usr/local/bin/docker-entrypoint.sh; \
64+
mkdir /docker-entrypoint-initdb.d; \
65+
install -m 1775 -o postgres -g postgres -d /run/postgresql; \
66+
install -d -m 0700 -o postgres -g postgres $PGDATA; \
67+
sed -ri "s|^#?(listen_addresses)\s*=\s*\S+.*|\1 = '*'|" /usr/share/postgresql16/postgresql.conf.sample
68+
69+
STOPSIGNAL SIGINT
70+
HEALTHCHECK --interval=10s --start-period=10s --timeout=5s \
71+
CMD pg_isready -U ${POSTGRES_USER:-postgres} -h localhost -p 5432
72+
73+
VOLUME $PGDATA
Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
# PostgreSQL 16 container image
2+
3+
![Support Level](https://img.shields.io/badge/Support_Level-acc-blue)
4+
[![SLSA](https://img.shields.io/badge/SLSA_(v0.1)-Level_4-Green)](https://documentation.suse.com/sbp/server-linux/html/SBP-SLSA4/)
5+
[![Provenance: Available](https://img.shields.io/badge/Provenance-Available-Green)](https://documentation.suse.com/container/all/html/Container-guide/index.html#container-verify)
6+
7+
## Description
8+
9+
PostgreSQL (often spelled as Postgres) is an extensible and SQL-compliant relational database management system (RDBMS).
10+
11+
PostgreSQL implements most of the SQL:2011 standard, and the RDBMS is ACID-compliant and transactional (including most DDL statements). The latter prevents locking issues using multiversion concurrency control (MVCC) as well as provides immunity to dirty reads and full serializability. PostgreSQL can handle complex SQL queries using different indexing methods that are not available in other databases. It features updateable views and materialized views, triggers, and foreign keys. The RDBMS supports functions and stored procedures. PostgreSQL's functionality can be extended using a vast collection of available extensions.
12+
13+
## Usage
14+
15+
By default, the image launches PostgreSQL with the same configuration that comes with SUSE Linux Enterprise Server.
16+
17+
The only environment variable required to start the container is the PostgreSQL root password.
18+
19+
```ShellSession
20+
$ podman run -it --rm -p 5432:5432 -e POSTGRES_PASSWORD=my-password -v /path/to/data:/var/lib/pgsql/data:Z registry.suse.com/suse/postgres:16-contrib
21+
```
22+
23+
## Volumes
24+
25+
### `/var/lib/pgsql/data`
26+
27+
PostgreSQL data directory location.
28+
29+
**Note 1:** The directory must be empty for `initdb` to create a new database.
30+
31+
**Note 2:** If the volume points either to a file system mount point, a remote folder that cannot be owned by the `postgres` user, or a location that already contains files (including `lost+found` and dotfiles), a new subdirectory for storing the PostgreSQL data must be created within the `PGDATA` volume.
32+
33+
## Environment variables
34+
35+
The PostgreSQL image uses several environment variables to configure the database initialization.
36+
37+
The only mandatory variable is `POSTGRES_PASSWORD`; other environment variables are optional.
38+
39+
### POSTGRES_PASSWORD
40+
41+
The `POSTGRES_PASSWORD` environment variable is required to use the PostgreSQL image. It must not be empty or undefined. This environment variable sets the superuser password for PostgreSQL.
42+
43+
### POSTGRES_USER
44+
45+
This optional environment variable is used in conjunction with `POSTGRES_PASSWORD` to set a user and its password. This variable creates the specified user with superuser power and a database with the same name. If it is not specified, the default user of `postgres` is used.
46+
47+
### POSTGRES_DB
48+
49+
This optional environment variable can be used to define a different name for the default database created when the image is first started. If it is not specified, the value of `POSTGRES_USER` is used.
50+
51+
### POSTGRES_INITDB_ARGS
52+
53+
This optional environment variable can be used to send arguments to `postgres initdb`. The value is a space-separated string of arguments as `postgres initdb` expects them. This is useful for adding actions like data page checksums: `-e POSTGRES_INITDB_ARGS="--data-checksums"`.
54+
55+
### POSTGRES_INITDB_WALDIR
56+
57+
This optional environment variable can be used to define another location for the Postgres transaction log. By default, the transaction log is stored in a subdirectory of the main Postgres data folder (`PGDATA`). In certain situations, it is desirable to store the transaction log in a different directory that may be backed by storage with different performance or reliability characteristics.
58+
59+
### POSTGRES_HOST_AUTH_METHOD
60+
61+
This optional variable can be used to control the `auth-method` for host connections for all databases, users, and addresses. If unspecified, the `scram-sha-256` password authentication is used.
62+
63+
On an uninitialized database, this populates `pg_hba.conf` via this approximate line:
64+
65+
`echo "host all all all $POSTGRES_HOST_AUTH_METHOD" >> pg_hba.conf`
66+
67+
For more information about possible values and their meanings, refer to the PostgreSQL documentation on [password Authentication](https://www.postgresql.org/docs/14/auth-password.html) and [pg_hba.conf](https://www.postgresql.org/docs/14/auth-pg-hba-conf.html).
68+
69+
**Note 1:** If you set `POSTGRES_HOST_AUTH_METHOD` to `trust`, then `POSTGRES_PASSWORD` is not required, since it allows anyone to connect without a password.
70+
71+
**Note 2:** If you set `POSTGRES_HOST_AUTH_METHOD` to an alternative value, you might need additional `POSTGRES_INITDB_ARGS` for the database to initialize correctly.
72+
73+
### PGDATA
74+
75+
The value for this variable is `/var/lib/pgsql/data`. This location is a volume and another location is currently not supported.
76+
77+
## Sensitive information
78+
79+
As an alternative to passing sensitive information via environment variables, `_FILE` can be appended to `POSTGRES_INITDB_ARGS`, `POSTGRES_PASSWORD`, `POSTGRES_USER`, and `POSTGRES_DB` environment variables. This makes the initialization script load the values for those variables from files present in the container. To, e.g., pass the password securely, you can store the password in a secret called `postgress-pw` and launch the container as follows:
80+
81+
```ShellSession
82+
$ podman run -it --rm
83+
-p 5432:5432 \
84+
-e POSTGRES_PASSWORD_FILE=/run/secrets/postgress-pw \
85+
--secret postgress-pw \
86+
-v /path/to/data:/var/lib/pgsql/data:Z \
87+
registry.suse.com/suse/postgres:16-contrib
88+
```
89+
90+
## Health, liveness, and readiness
91+
92+
There is one explicit health check added to the container image. This check executes the `pg_isready` for host `localhost` and port `5432`.
93+
94+
The utility [pg_isread](https://www.postgresql.org/docs/current/app-pg-isready.html) checks the connection status of the server, and the exit status specifies the result of the connection check.
95+
96+
## Initialization scripts
97+
98+
To perform additional initialization in an image derived from this one, add one or more `*.sql`, `*.sql.gz`, or `*.sh` scripts under `/docker-entrypoint-initdb.d`. After the entrypoint calls `initdb` to create the default PostgreSQL user and database, it runs any `*.sql` files, runs any executable `*.sh` scripts, and sources any non-executable `*.sh` scripts found in that directory to perform further initialization before starting the service.
99+
100+
**Warning:** Scripts in `/docker-entrypoint-initdb.d` are only executed when you start the container with an empty data directory. Any pre-existing databases are left untouched when the container starts.
101+
102+
**Note:** If one of the `/docker-entrypoint-initdb.d` scripts fails, and the container restarts with the already initialized data directory, it aborts the running scripts.
103+
104+
## Database configuration
105+
106+
For information on the available configuration options, refer to the [PostgreSQL documentation](https://www.postgresql.org/docs/current/runtime-config.html) covering the specific version of your PostgreSQL server.
107+
108+
Below is a list of the most common configuration options:
109+
110+
- Set options directly on the container run line via `-c`.
111+
- Use a custom configuration file and mount it.
112+
113+
**Note:** Configuration files (`postgresql.auto.conf`, `postgresql.conf`, `pg_hba.conf`, and `pg_ident.conf`) are stored in the location defined in `PGDATA`.
114+
115+
## Backup and restore
116+
117+
The utilities `pg_dump` and `pg_dumpall` are available in the container.
118+
119+
To dump the entire contents of a database cluster, run the following command:
120+
121+
```ShellSession
122+
$ podman exec -t $CONTAINER_ID pg_dumpall -c -U $POSTGRES_USER > dump.sql
123+
```
124+
125+
To restore a dump, run the following command:
126+
127+
```ShellSession
128+
$ cat dump.sql | podman exec -i $CONTAINER_ID psql -U $POSTGRES_USER -d $POSTGRES_DB
129+
```
130+
131+
For more information on how to perform backup and restore, refer to the [PostgreSQL documentation](https://www.postgresql.org/docs/current/backup.html).
132+
133+
## Licensing
134+
135+
`SPDX-License-Identifier: PostgreSQL`
136+
137+
This documentation and the build recipe are licensed as PostgreSQL.
138+
The container itself contains various software components under various open source licenses listed in the associated
139+
Software Bill of Materials (SBOM).
140+
141+
This image is based on [SUSE Linux Enterprise Server](https://www.suse.com/products/server/), a reliable,
142+
secure, and scalable server operating system built to power mission-critical workloads in physical and virtual environments.

postgres-16-image/_multibuild

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<multibuild>
2+
<package>contrib</package>
3+
</multibuild>

postgres-16-image/_service

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
<service mode="buildtime" name="docker_label_helper"/>
33
<service mode="buildtime" name="kiwi_metainfo_helper"/>
44
<service mode="buildtime" name="replace_using_package_version">
5-
<param name="file">Dockerfile</param>
5+
<param name="file">Dockerfile.contrib</param>
66
<param name="regex">%%pg_minor_version%%</param>
77
<param name="package">postgresql16-server</param>
88
<param name="parse-version">minor</param>
99
</service>
1010
<service mode="buildtime" name="replace_using_package_version">
11-
<param name="file">Dockerfile</param>
11+
<param name="file">Dockerfile.contrib</param>
1212
<param name="regex">%%pg_patch_version%%</param>
1313
<param name="package">postgresql16-server</param>
1414
<param name="parse-version">patch</param>
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# SPDX-License-Identifier: PostgreSQL
2+
3+
# Copyright (c) 2025 SUSE LLC
4+
5+
# All modifications and additions to the file contributed by third parties
6+
# remain the property of their copyright owners, unless otherwise agreed
7+
# upon.
8+
9+
# The content of THIS FILE IS AUTOGENERATED and should not be manually modified.
10+
# It is maintained by the BCI team and generated by
11+
# https://github.com/SUSE/BCI-dockerfile-generator
12+
13+
# Please submit bugfixes or comments via https://bugs.opensuse.org/
14+
# You can contact the BCI team via https://github.com/SUSE/bci/discussions
15+
16+
#!UseOBSRepositories
17+
18+
#!BuildTag: suse/postgres:%%pg_patch_version%%-contrib-%RELEASE%
19+
#!BuildTag: suse/postgres:%%pg_patch_version%%-contrib
20+
#!BuildTag: suse/postgres:17-contrib
21+
#!BuildTag: suse/postgres:%%pg_minor_version%%
22+
#!BuildTag: suse/postgres:latest
23+
#!BcntSyncTag: postgres-17-image
24+
#!BuildName: suse-postgres-17-contrib
25+
#!BuildVersion: 16.0.17
26+
FROM bci/bci-micro:16.0 AS target
27+
FROM bci/bci-base:16.0 AS builder
28+
COPY --from=target / /target
29+
30+
RUN set -euo pipefail; \
31+
zypper -n --installroot /target --gpg-auto-import-keys install --no-recommends libpq5 postgresql17-server findutils coreutils sed util-linux postgresql17-contrib postgresql17-pgvector
32+
RUN set -euo pipefail; zypper -n --installroot /target clean -a; \
33+
rm -rf {/target,}/var/log/{alternatives.log,lastlog,tallylog,zypper.log,zypp/history,YaST2}
34+
FROM bci/bci-micro:16.0
35+
COPY --from=builder /target /
36+
# Define labels according to https://en.opensuse.org/Building_derived_containers
37+
# labelprefix=com.suse.application.postgres
38+
LABEL org.opencontainers.image.authors="https://github.com/SUSE/bci/discussions"
39+
LABEL org.opencontainers.image.title="SLE PostgreSQL 17"
40+
LABEL org.opencontainers.image.description="PostgreSQL 17 container based on the SLE Base Container Image."
41+
LABEL org.opencontainers.image.version="%%pg_patch_version%%"
42+
LABEL org.opencontainers.image.url="https://www.suse.com/products/base-container-images/"
43+
LABEL org.opencontainers.image.created="%BUILDTIME%"
44+
LABEL org.opencontainers.image.vendor="SUSE LLC"
45+
LABEL org.opencontainers.image.source="%SOURCEURL%"
46+
LABEL org.opencontainers.image.ref.name="%%pg_patch_version%%-contrib-%RELEASE%"
47+
LABEL org.opensuse.reference="registry.suse.com/suse/postgres:%%pg_patch_version%%-contrib-%RELEASE%"
48+
LABEL org.openbuildservice.disturl="%DISTURL%"
49+
LABEL com.suse.supportlevel="acc"
50+
LABEL com.suse.eula="sle-eula"
51+
LABEL com.suse.lifecycle-url="https://www.suse.com/lifecycle"
52+
LABEL com.suse.release-stage="beta"
53+
# endlabelprefix
54+
LABEL io.artifacthub.package.readme-url="%SOURCEURL_WITH(README.contrib.md)%"
55+
ENV LANG="en_US.utf8"
56+
ENV PGDATA="/var/lib/pgsql/data"
57+
ENV PG_MAJOR="17"
58+
ENV PG_VERSION="%%pg_minor_version%%"
59+
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
60+
CMD ["postgres"]
61+
EXPOSE 5432/tcp
62+
COPY docker-entrypoint.sh /usr/local/bin/
63+
RUN set -euo pipefail; chmod +x /usr/local/bin/docker-entrypoint.sh; \
64+
sed -i -e 's/exec gosu postgres "/exec setpriv --reuid=postgres --regid=postgres --clear-groups -- "/g' /usr/local/bin/docker-entrypoint.sh; \
65+
mkdir /docker-entrypoint-initdb.d; \
66+
install -m 1775 -o postgres -g postgres -d /run/postgresql; \
67+
install -d -m 0700 -o postgres -g postgres $PGDATA; \
68+
sed -ri "s|^#?(listen_addresses)\s*=\s*\S+.*|\1 = '*'|" /usr/share/postgresql17/postgresql.conf.sample
69+
70+
STOPSIGNAL SIGINT
71+
HEALTHCHECK --interval=10s --start-period=10s --timeout=5s \
72+
CMD pg_isready -U ${POSTGRES_USER:-postgres} -h localhost -p 5432
73+
74+
VOLUME $PGDATA

0 commit comments

Comments
 (0)