Skip to content
This repository was archived by the owner on Apr 4, 2026. It is now read-only.

feat: add multi-architecture support (amd64 + arm64) #8

feat: add multi-architecture support (amd64 + arm64)

feat: add multi-architecture support (amd64 + arm64) #8

Workflow file for this run

name: Docker PostGIS CI
on:
push:
pull_request:
schedule:
- cron: '15 5 * * 1'
defaults:
run:
shell: bash
jobs:
make-docker-images:
strategy:
matrix:
runner-platform: ['ubuntu-24.04', 'ubuntu-24.04-arm']
postgres: [13, 14, 15, 16, 17 ]
postgis: ['3.5']
variant: [default, alpine]
include:
- postgres: 16
postgis: master
variant: default
runner-platform: 'ubuntu-24.04'
- postgres: 17
postgis: master
variant: default
runner-platform: 'ubuntu-24.04'
- postgres: 16
postgis: master
variant: default
runner-platform: 'ubuntu-24.04-arm'
- postgres: 17
postgis: master
variant: default
runner-platform: 'ubuntu-24.04-arm'
- postgres: 17
postgis: '3.6'
variant: alpine
runner-platform: 'ubuntu-24.04'
- postgres: 17
postgis: '3.6'
variant: alpine
runner-platform: 'ubuntu-24.04-arm'
- postgres: 18
postgis: '3.6'
variant: alpine
runner-platform: 'ubuntu-24.04'
- postgres: 18
postgis: '3.6'
variant: alpine
runner-platform: 'ubuntu-24.04-arm'
- postgres: 18
postgis: '3.6'
variant: default
runner-platform: 'ubuntu-24.04'
- postgres: 18
postgis: '3.6'
variant: default
runner-platform: 'ubuntu-24.04-arm'
name: ${{ matrix.postgres }}-${{ matrix.postgis }}-${{ matrix.variant }} ${{ matrix.runner-platform }} - Build Docker image
runs-on: ${{ matrix.runner-platform }}
continue-on-error: ${{ matrix.postgis == 'master' }}
env:
VERSION: ${{ matrix.postgres }}-${{ matrix.postgis }}
VARIANT: ${{ matrix.variant }}
DOCKER_APT_PKG_VER: '5:29.2.1-1~ubuntu.24.04~noble'
steps:
- name: Install/config specific version of Docker packages
run: |
echo "***** Removing any currently installed conflicting packages..."
for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do sudo apt-get remove $pkg; done
echo "***** Setting up Docker's APT repo..."
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
echo "***** Check available docker-ce versions ."
sudo apt policy docker-ce
echo "***** Installing Docker packages..."
sudo apt-get install docker-ce=${{ env.DOCKER_APT_PKG_VER }} docker-ce-cli=${{ env.DOCKER_APT_PKG_VER }} containerd.io docker-buildx-plugin docker-compose-plugin
echo "***** Verifying initial Docker installation..."
docker run hello-world
echo "***** Displaying Docker information..."
docker info
echo "***** Configuring Docker for containerd image store and builder keepStorage..."
echo "{ \"features\": { \"containerd-snapshotter\": true }}" | sudo tee /etc/docker/daemon.json
echo $'{
"features": {
"containerd-snapshotter": true
},
"builder": {
"gc": {
"defaultKeepStorage": "20GB",
"enabled": true
}
}
}' | sudo tee /etc/docker/daemon.json
sudo systemctl restart docker
docker info -f '{{ .DriverStatus }}'
- name: Load binfmt platforms for QEMU
run: |
docker run --privileged --rm tonistiigi/binfmt --install all
docker images --tree
- name: Checkout source
uses: actions/checkout@v4
- name: Build docker image for ${{ env.VERSION }} ${{ env.VARIANT }}
run: make test
- name: Login to dockerhub
uses: docker/login-action@v3
if: ${{ (github.repository == 'postgis/docker-postgis') && (github.ref == 'refs/heads/master') && (github.event_name != 'pull_request') }}
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}
- name: Push docker image to dockerhub
if: ${{ (github.repository == 'postgis/docker-postgis') && (github.ref == 'refs/heads/master') && (github.event_name != 'pull_request') && ( matrix.runner-platform == 'ubuntu-24.04' ) }}
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_ACCESS_TOKEN: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}
run: make push
- name: Push arch-tagged image for multi-arch manifest
if: ${{ (github.repository == 'postgis/docker-postgis') && (github.ref == 'refs/heads/master') && (github.event_name != 'pull_request') }}
run: |
ARCH=${{ matrix.runner-platform == 'ubuntu-24.04' && 'amd64' || 'arm64' }}
if [ "${{ env.VARIANT }}" = "default" ]; then
docker image tag postgis/postgis:${{ env.VERSION }} postgis/postgis:${{ env.VERSION }}-${ARCH}
docker image push postgis/postgis:${{ env.VERSION }}-${ARCH}
elif [ -d "${{ env.VERSION }}/alpine" ]; then
docker image tag postgis/postgis:${{ env.VERSION }}-alpine postgis/postgis:${{ env.VERSION }}-alpine-${ARCH}
docker image push postgis/postgis:${{ env.VERSION }}-alpine-${ARCH}
fi
# Combine arch-tagged images into multi-arch manifests
create-manifests:
needs: make-docker-images
if: ${{ (github.repository == 'postgis/docker-postgis') && (github.ref == 'refs/heads/master') && (github.event_name != 'pull_request') }}
name: Create multi-arch manifests
runs-on: ubuntu-24.04
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Login to dockerhub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}
- name: Create and push multi-arch manifests
run: |
REPO=postgis/postgis
LATEST_VERSION=17-3.5
# Discover versions from the directory structure (same source of truth as the Makefile)
for dir in */Dockerfile; do
ver=$(dirname "$dir")
echo "==> Creating manifest for ${REPO}:${ver}"
docker manifest create "${REPO}:${ver}" \
"${REPO}:${ver}-amd64" "${REPO}:${ver}-arm64" || true
docker manifest push "${REPO}:${ver}" || true
if [ -d "${ver}/alpine" ]; then
echo "==> Creating manifest for ${REPO}:${ver}-alpine"
docker manifest create "${REPO}:${ver}-alpine" \
"${REPO}:${ver}-alpine-amd64" "${REPO}:${ver}-alpine-arm64" || true
docker manifest push "${REPO}:${ver}-alpine" || true
fi
done
echo "==> Creating manifest for ${REPO}:latest"
docker manifest create "${REPO}:latest" \
"${REPO}:${LATEST_VERSION}-amd64" "${REPO}:${LATEST_VERSION}-arm64" || true
docker manifest push "${REPO}:latest" || true