diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2617f7342..34a902448 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,23 +1,24 @@ +--- name: Docker PostGIS CI on: push: pull_request: schedule: - - cron: '15 5 * * 1' + - cron: "15 5 * * 1" defaults: run: shell: bash jobs: - make-docker-images: strategy: matrix: postgres: [12, 13, 14, 15, 16, 17] - postgis: ['3.5'] + postgis: ["3.5"] variant: [default, alpine] + arch: ["linux/amd64", "linux/arm64"] include: - postgres: 16 postgis: master @@ -26,31 +27,52 @@ jobs: postgis: master variant: default - name: Build docker image for ${{ matrix.postgres }}-${{ matrix.postgis }} variant ${{ matrix.variant }} + name: >- + Build docker image for + ${{ matrix.arch }}-${{ matrix.postgres }}-${{ matrix.postgis }} + variant ${{ matrix.variant }} runs-on: ubuntu-20.04 continue-on-error: ${{ matrix.postgis == 'master' }} env: VERSION: ${{ matrix.postgres }}-${{ matrix.postgis }} + ARCH: ${{ matrix.arch }} VARIANT: ${{ matrix.variant }} steps: - - 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.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.ref == 'refs/heads/master') && (github.event_name != 'pull_request') }} - env: - DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} - DOCKERHUB_ACCESS_TOKEN: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }} - run: make push + - name: Checkout source + uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: >- + Build docker image for + ${{ env.ARCH }} + ${{ env.VERSION }} + ${{ env.VARIANT }} + run: make test + + - name: Login to dockerhub + uses: docker/login-action@v3 + if: >- + ${{ + (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.ref == 'refs/heads/master') && + (github.event_name != 'pull_request') + }} + env: + DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} + DOCKERHUB_ACCESS_TOKEN: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }} + run: make push diff --git a/Makefile b/Makefile index cb6f6abba..a9f1aa9ef 100644 --- a/Makefile +++ b/Makefile @@ -76,12 +76,12 @@ update: define build-version build-$1: ifeq ($(do_default),true) - $(DOCKER) build --pull -t $(REPO_NAME)/$(IMAGE_NAME):$(shell echo $1) $1 + $(DOCKER) build --platform=$(ARCH) --pull -t $(REPO_NAME)/$(IMAGE_NAME):$(shell echo $1) $1 $(DOCKER) images $(REPO_NAME)/$(IMAGE_NAME):$(shell echo $1) endif ifeq ($(do_alpine),true) ifneq ("$(wildcard $1/alpine)","") - $(DOCKER) build --pull -t $(REPO_NAME)/$(IMAGE_NAME):$(shell echo $1)-alpine $1/alpine + $(DOCKER) build --platform=$(ARCH) --pull -t $(REPO_NAME)/$(IMAGE_NAME):$(shell echo $1)-alpine $1/alpine $(DOCKER) images $(REPO_NAME)/$(IMAGE_NAME):$(shell echo $1)-alpine endif endif diff --git a/README.md b/README.md index 5211685ba..1f4d483da 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Unless `-e POSTGRES_DB` is passed to the container at startup time, this databas # Versions (2025-01-23) -Supported architecture: `amd64` (also known as X86-64)" +Supported architectures: `amd64` (also known as X86-64)", `arm64` Recommended versions for new users are: `postgis/postgis:17-3.5`, `postgis/postgis:16-3.5`