Skip to content
Merged
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
54 changes: 54 additions & 0 deletions .github/workflows/build_postgres_image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Postgres image for CI

on:
# Run daily at 00:00 UTC. This allows the image to pick up updates from upstream and avoid
# going stale.
schedule:
- cron: '0 0 * * 0'
# Allow manual triggering
workflow_dispatch:

jobs:
build_image:
name: 'Build postgres:${{ matrix.postgres_version }}-alpine-logical'
runs-on: ubuntu-latest

permissions:
packages: write

strategy:
matrix:
# The same versions are used by elixir_tests.yml
postgres_version: [14, 15, 17, 18]

steps:
- name: Set image ref
id: vars
run: |
echo "IMAGE=ghcr.io/${{ github.repository }}/postgres" >> $GITHUB_ENV

- name: Login to GHCR (private)
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up buildx for advanced Docker caching
uses: docker/setup-buildx-action@v3

- name: Prepare the Dockerfile
run: |
echo '
FROM postgres:${{ matrix.postgres_version }}-alpine
CMD ["postgres", "-c", "wal_level=logical", "-c", "max_replication_slots=40"]
' > Dockerfile

- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: '${{ env.IMAGE }}:${{ matrix.postgres_version }}-alpine-logical'
cache-from: type=gha
cache-to: type=gha,mode=max