Skip to content

feat: add PostgreSQL 17beta1 images #107

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Debian/17/bookworm/.versions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"BARMAN_VERSION": "3.10.0",
"IMAGE_RELEASE_VERSION": "1",
"POSTGRES_IMAGE_LAST_UPDATED": "2024-06-04T23:12:01.432773Z",
"POSTGRES_IMAGE_VERSION": "17beta1-bookworm"
}
55 changes: 55 additions & 0 deletions Debian/17/bookworm/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# vim:set ft=dockerfile:
#
# Copyright The CloudNativePG Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
FROM postgres:17beta1-bookworm

# Do not split the description, otherwise we will see a blank space in the labels
LABEL name="PostgreSQL Container Images" \
vendor="The CloudNativePG Contributors" \
version="${PG_VERSION}" \
release="1" \
summary="PostgreSQL Container images." \
description="This Docker image contains PostgreSQL and Barman Cloud based on Postgres 17beta1-bookworm."

LABEL org.opencontainers.image.description="This Docker image contains PostgreSQL and Barman Cloud based on Postgres 17beta1-bookworm."

COPY requirements.txt /

# Install additional extensions
RUN set -xe; \
apt-get update; \
apt-get install -y --no-install-recommends \
"postgresql-${PG_MAJOR}-pgvector" \
; \
rm -fr /tmp/* ; \
rm -rf /var/lib/apt/lists/*;

# Install barman-cloud
RUN set -xe; \
apt-get update; \
apt-get install -y --no-install-recommends \
python3-pip \
python3-psycopg2 \
python3-setuptools \
; \
pip3 install --break-system-packages --upgrade pip; \
# TODO: Remove --no-deps once https://github.com/pypa/pip/issues/9644 is solved
pip3 install --break-system-packages --no-deps -r requirements.txt; \
rm -rf /var/lib/apt/lists/*;

# Change the uid of postgres to 26
RUN usermod -u 26 postgres
USER 26
544 changes: 544 additions & 0 deletions Debian/17/bookworm/requirements.txt

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions Debian/17/bullseye/.versions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"BARMAN_VERSION": "3.10.0",
"IMAGE_RELEASE_VERSION": "1",
"POSTGRES_IMAGE_LAST_UPDATED": "2024-06-04T23:12:11.024627Z",
"POSTGRES_IMAGE_VERSION": "17beta1-bullseye"
}
55 changes: 55 additions & 0 deletions Debian/17/bullseye/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# vim:set ft=dockerfile:
#
# Copyright The CloudNativePG Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
FROM postgres:17beta1-bullseye

# Do not split the description, otherwise we will see a blank space in the labels
LABEL name="PostgreSQL Container Images" \
vendor="The CloudNativePG Contributors" \
version="${PG_VERSION}" \
release="1" \
summary="PostgreSQL Container images." \
description="This Docker image contains PostgreSQL and Barman Cloud based on Postgres 17beta1-bullseye."

LABEL org.opencontainers.image.description="This Docker image contains PostgreSQL and Barman Cloud based on Postgres 17beta1-bullseye."

COPY requirements.txt /

# Install additional extensions
RUN set -xe; \
apt-get update; \
apt-get install -y --no-install-recommends \
"postgresql-${PG_MAJOR}-pgvector" \
; \
rm -fr /tmp/* ; \
rm -rf /var/lib/apt/lists/*;

# Install barman-cloud
RUN set -xe; \
apt-get update; \
apt-get install -y --no-install-recommends \
python3-pip \
python3-psycopg2 \
python3-setuptools \
; \
pip3 install --upgrade pip; \
# TODO: Remove --no-deps once https://github.com/pypa/pip/issues/9644 is solved
pip3 install --no-deps -r requirements.txt; \
rm -rf /var/lib/apt/lists/*;

# Change the uid of postgres to 26
RUN usermod -u 26 postgres
USER 26
544 changes: 544 additions & 0 deletions Debian/17/bullseye/requirements.txt

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion Debian/Dockerfile-beta.template
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,15 @@ LABEL name="PostgreSQL Container Images" \
summary="PostgreSQL Container images." \
description="This Docker image contains PostgreSQL and Barman Cloud based on Postgres %%POSTGRES_IMAGE_VERSION%%."

LABEL org.opencontainers.image.description="This Docker image contains PostgreSQL and Barman Cloud based on Postgres %%POSTGRES_IMAGE_VERSION%%."

COPY requirements.txt /

# Install additional extensions
RUN set -xe; \
apt-get update; \
apt-get install -y --no-install-recommends \
"postgresql-${PG_MAJOR}-pgvector" \
"postgresql-${PG_MAJOR}-pgaudit" \
; \
rm -fr /tmp/* ; \
rm -rf /var/lib/apt/lists/*;
Expand Down
56 changes: 56 additions & 0 deletions Debian/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Debian-based Container Images

This folder contains the `Dockerfile` manifests needed to build Debian-based
PostgreSQL operand container images for use with CloudNativePG.

The images are based on the official [PostgreSQL images on
DockerHub](https://hub.docker.com/_/postgres).

The folder includes:

- Directories for each supported PostgreSQL version.
- [Image catalog
files](https://cloudnative-pg.io/documentation/current/image_catalog/) for
each Debian version.
- Templates for the main `Dockerfile` and the beta version `Dockerfile`
(typically identical, except for some extensions that are not ready for the
new major release of PostgreSQL).
- The `requirements.in` file required to build Barman Cloud images. (Note: This
file will be removed once a Barman Cloud plugin supporting CNPG-I is
distributed.)
- The main update script.

## Adding a New Beta Version

To add a new beta version, follow these steps:

1. Create a new issue in the ["postgres-containers" project](https://github.com/cloudnative-pg/postgres-containers)
with the title "Add PostgreSQL XX beta1 images".
2. Clone the `postgres-containers` repository.
3. Create a new branch named after the issue ID (e.g., `dev/YYY`).
4. Create the `Debian/XX/` directory.
5. Identify the latest Debian version name (e.g., `bookworm`).
6. Run `Debian/update.sh XX -d bookworm` which will create a
`.versions.json` file into the `Debian/XX/bookworm/` directory.
7. Add the new directory to your commit and push the changes.
8. Run the `Automatic updates` action on the branch and wait for it to complete
(this will add a commit to the branch).
9. Submit a pull request.


## Troubleshooting

### Common issues

* Error while running `update.sh`

```
sed: can't read requirements.txt: No such file or directory
cat: requirements.txt: No such file or directory
rm: cannot remove 'requirements.txt': No such file or directory
```

If a similar error appears, the reason is that you are missing the
`pip-compile` utility that's needed to build the python requirements
for Barman Cloud. (Note: This requirement will be removed once a
Barman Cloud plugin supporting CNPG-I is distributed.)
5 changes: 4 additions & 1 deletion lib/repo_funcs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
# limitations under the License.
#

# Update this everytime a new major release of PostgreSQL is available
POSTGRESQL_LATEST_MAJOR_RELEASE=16

# Get the last postgres base image tag and update time
fetch_postgres_image_version() {
local suite="$1"; shift
Expand Down Expand Up @@ -133,7 +136,7 @@ generate_postgres() {
fi

dockerTemplate="Dockerfile.template"
if [[ ${version} -gt "16" ]]; then
if [[ ${version} -gt "${POSTGRESQL_LATEST_MAJOR_RELEASE}" ]]; then
dockerTemplate="Dockerfile-beta.template"
fi

Expand Down