Skip to content
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
4 changes: 3 additions & 1 deletion .github/workflows/auto-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ jobs:
uses: actions/checkout@v7
-
name: Create Pull Request
run: gh pr create -B main --title "${{ github.ref_name }}" --body "Merging branch to create ${{ github.ref_name }}."
# pass the branch name as a variable - ${{ }} in run is pasted into the script, so a branch name could run code
run: gh pr create -B main --title "${BRANCH}" --body "Merging branch to create ${BRANCH}."
env:
BRANCH: ${{ github.ref_name }}
GITHUB_TOKEN: ${{ secrets.PAT }}
42 changes: 42 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: build

on:
push:
branches: ['**']
tags-ignore: ['**']
release:
types: [published]
workflow_dispatch:

# one run per branch at a time - a newer push cancels the older run, so it cannot finish last and overwrite the
# newer images
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
uses: bfren/docker/.github/workflows/build.yml@main
with:
image: postgresql
folders: |
14
15
16
17
18
platforms: |
linux/amd64
linux/arm/v7
linux/arm64
tags: |
postgresql${FOLDER}
postgresql${FOLDER}-${VERSION_MAJOR}
postgresql${FOLDER}-${VERSION_MINOR}
postgresql${FOLDER}-${VERSION}
postgresql${POSTGRESQL_MINOR}
postgresql${POSTGRESQL_MINOR}-${VERSION}
secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
QUAY_TOKEN: ${{ secrets.QUAY_TOKEN }}
113 changes: 0 additions & 113 deletions .github/workflows/dev.yml

This file was deleted.

94 changes: 0 additions & 94 deletions .github/workflows/publish.yml

This file was deleted.

8 changes: 1 addition & 7 deletions .github/workflows/update-readme.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,9 @@ jobs:
-
name: Checkout code
uses: actions/checkout@v7
-
name: Login to DockerHub
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Update repo description with README.md
uses: peter-evans/dockerhub-description@v5
uses: peter-evans/dockerhub-description@1b9a80c056b620d92cedb9d9b5a223409c68ddfa # v5
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion 14/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM quay.io/bfren/alpine-s6:alpine3.20-6.7.3
FROM quay.io/bfren/alpine-s6:alpine3.20-7.0.0

LABEL org.opencontainers.image.source="https://github.com/bfren/docker-postgresql"

Expand Down
2 changes: 1 addition & 1 deletion 15/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM quay.io/bfren/alpine-s6:alpine3.22-6.7.3
FROM quay.io/bfren/alpine-s6:alpine3.22-7.0.0

LABEL org.opencontainers.image.source="https://github.com/bfren/docker-postgresql"

Expand Down
2 changes: 1 addition & 1 deletion 16/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM quay.io/bfren/alpine-s6:alpine3.24-6.7.3
FROM quay.io/bfren/alpine-s6:alpine3.24-7.0.0

LABEL org.opencontainers.image.source="https://github.com/bfren/docker-postgresql"

Expand Down
2 changes: 1 addition & 1 deletion 17/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM quay.io/bfren/alpine-s6:alpine3.24-6.7.3
FROM quay.io/bfren/alpine-s6:alpine3.24-7.0.0

LABEL org.opencontainers.image.source="https://github.com/bfren/docker-postgresql"

Expand Down
2 changes: 1 addition & 1 deletion 18/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM quay.io/bfren/alpine-s6:alpine3.24-6.7.3
FROM quay.io/bfren/alpine-s6:alpine3.24-7.0.0

LABEL org.opencontainers.image.source="https://github.com/bfren/docker-postgresql"

Expand Down
26 changes: 26 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [6.0.0] - 2026-11-05

### Changed

- **Breaking:** base image updated to `bfren/alpine-s6` 7.0.0 - see the
[Alpine + S6 changelog](https://github.com/bfren/docker-alpine-s6/blob/main/CHANGELOG.md).
`bf env set` must now run as root.
- Images are built and published by the shared `bfren/docker` build workflow (`build.yml`), replacing the separate
`dev.yml` and `publish.yml` workflows.

### Fixed

- A restore no longer deletes the dump file: it is renamed `dump.sql.restored`, and errors from `psql` (which carries
on after a failed statement) are saved to `dump.sql.log`, with a warning if any statement failed.
- Backups are written straight to the file instead of being held in memory first, so large databases no longer need
that much memory to back up.
- `pg-export dump` is refused - `/backup/dump.sql` would replace the whole cluster on the next start.

[6.0.0]: https://github.com/bfren/docker-postgresql/compare/v5.0.0...v6.0.0
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# PostgreSQL

![GitHub release (latest by date)](https://img.shields.io/github/v/release/bfren/docker-postgresql) ![Docker Pulls](https://img.shields.io/endpoint?url=https%3A%2F%2Fbfren.dev%2Fdocker%2Fpulls%2Fpostgresql) ![Docker Image Size](https://img.shields.io/endpoint?url=https%3A%2F%2Fbfren.dev%2Fdocker%2Fsize%2Fpostgresql) ![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/bfren/docker-postgresql/dev.yml?branch=main)
![GitHub release (latest by date)](https://img.shields.io/github/v/release/bfren/docker-postgresql) ![Docker Pulls](https://img.shields.io/endpoint?url=https%3A%2F%2Fbfren.dev%2Fdocker%2Fpulls%2Fpostgresql) ![Docker Image Size](https://img.shields.io/endpoint?url=https%3A%2F%2Fbfren.dev%2Fdocker%2Fsize%2Fpostgresql) ![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/bfren/docker-postgresql/build.yml?branch=main)

[Docker Hub](https://hub.docker.com/r/bfren/postgresql) - [Quay.io](https://quay.io/repository/bfren/postgresql) - [bfren ecosystem](https://github.com/bfren/docker)

Expand All @@ -17,7 +17,7 @@ It is built on [Alpine + S6](https://github.com/bfren/docker-alpine-s6), with Po
```yaml
services:
db:
image: quay.io/bfren/postgresql:postgresql18-4.3
image: quay.io/bfren/postgresql:postgresql18-6.0
restart: unless-stopped
environment:
- BF_PG_APPLICATION=myapp
Expand Down Expand Up @@ -58,11 +58,11 @@ Images are published to Docker Hub (`bfren/postgresql`) and Quay.io (`quay.io/bf
| Tag | Example | Use when |
| ----------------------- | ---------------------- | -------------------------------------------------- |
| `postgresqlN` | `postgresql18` | You want the latest image for a PostgreSQL version |
| `postgresqlN-MAJOR` | `postgresql18-4` | You want updates, but not breaking changes |
| `postgresqlN-MINOR` | `postgresql18-4.3` | You want fixes only - **recommended** |
| `postgresqlN-VERSION` | `postgresql18-4.3.0` | You want to pin this image exactly |
| `postgresqlN-MAJOR` | `postgresql18-6` | You want updates, but not breaking changes |
| `postgresqlN-MINOR` | `postgresql18-6.0` | You want fixes only - **recommended** |
| `postgresqlN-VERSION` | `postgresql18-6.0.0` | You want to pin this image exactly |
| `postgresqlN.M` | `postgresql18.6` | You want an exact PostgreSQL release |
| `postgresqlN.M-VERSION` | `postgresql18.6-4.3.0` | You want to pin both |
| `postgresqlN.M-VERSION` | `postgresql18.6-6.0.0` | You want to pin both |

| PostgreSQL | Release | Alpine | Supported until |
| ---------- | ------- | ------ | --------------- |
Expand Down Expand Up @@ -142,11 +142,11 @@ At a random minute every eight hours (00:xx, 08:xx and 16:xx in `BF_TZ`), `pg-du

`pg-restore <folder>` restores a backup folder's `dump.sql` (or `dump.sql.bz2`), e.g. `pg-restore 202610171608`. It **replaces the whole cluster**: PostgreSQL is stopped, `/data` is emptied, a new cluster is created from the dump, and PostgreSQL starts again.

You can also restore while the container is stopped: put `dump.sql` or `dump.sql.bz2` in the root of `/backup` and start the container. The dump file is deleted once it has been restored.
You can also restore while the container is stopped: put `dump.sql` or `dump.sql.bz2` in the root of `/backup` and start the container. The dump file is renamed `dump.sql.restored` once it has been restored, and `psql`'s errors are saved to `dump.sql.log` - check `docker logs` for a warning that some statements failed.

### Export and import

* `pg-export <database>` saves `/backup/<database>.sql`.
* `pg-export <database>` saves `/backup/<database>.sql` - except for a database called `dump`, because `/backup/dump.sql` is restored over the whole cluster on the next start.
* `pg-import <database>` runs `/backup/<database>.sql` in that database, creating it (owned by the application user) if it doesn't exist. Files from `pg-export` and the per-database backup files drop and recreate the tables they contain.

To move a database between containers, `pg-export` in one, copy the file to the other's `/backup`, then `pg-import`.
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.0.0
6.0.0
2 changes: 1 addition & 1 deletion VERSION_MAJOR
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5
6
2 changes: 1 addition & 1 deletion VERSION_MINOR
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.0
6.0
Loading
Loading