Skip to content

Commit a1388ff

Browse files
Updated workflow file main.yml to build arm64 images
- tested locally and in a runtime environment
1 parent 0eb34a5 commit a1388ff

File tree

3 files changed

+48
-26
lines changed

3 files changed

+48
-26
lines changed

.github/workflows/main.yml

+45-23
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
1+
---
12
name: Docker PostGIS CI
23

34
on:
45
push:
56
pull_request:
67
schedule:
7-
- cron: '15 5 * * 1'
8+
- cron: "15 5 * * 1"
89

910
defaults:
1011
run:
1112
shell: bash
1213

1314
jobs:
14-
1515
make-docker-images:
1616
strategy:
1717
matrix:
1818
postgres: [12, 13, 14, 15, 16, 17]
19-
postgis: ['3.5']
19+
postgis: ["3.5"]
2020
variant: [default, alpine]
21+
arch: ["linux/amd64", "linux/arm64"]
2122
include:
2223
- postgres: 16
2324
postgis: master
@@ -26,31 +27,52 @@ jobs:
2627
postgis: master
2728
variant: default
2829

29-
name: Build docker image for ${{ matrix.postgres }}-${{ matrix.postgis }} variant ${{ matrix.variant }}
30+
name: >-
31+
Build docker image for
32+
${{ matrix.arch }}-${{ matrix.postgres }}-${{ matrix.postgis }}
33+
variant ${{ matrix.variant }}
3034
runs-on: ubuntu-20.04
3135
continue-on-error: ${{ matrix.postgis == 'master' }}
3236
env:
3337
VERSION: ${{ matrix.postgres }}-${{ matrix.postgis }}
38+
ARCH: ${{ matrix.arch }}
3439
VARIANT: ${{ matrix.variant }}
3540

3641
steps:
37-
- name: Checkout source
38-
uses: actions/checkout@v4
39-
40-
- name: Build docker image for ${{ env.VERSION }} ${{ env.VARIANT }}
41-
run: make test
42-
43-
- name: Login to dockerhub
44-
uses: docker/login-action@v3
45-
if: ${{ (github.ref == 'refs/heads/master') && (github.event_name != 'pull_request') }}
46-
with:
47-
username: ${{ secrets.DOCKERHUB_USERNAME }}
48-
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}
49-
50-
- name: Push docker image to dockerhub
51-
if: ${{ (github.ref == 'refs/heads/master') && (github.event_name != 'pull_request') }}
52-
env:
53-
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
54-
DOCKERHUB_ACCESS_TOKEN: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}
55-
run: make push
42+
- name: Checkout source
43+
uses: actions/checkout@v4
44+
45+
- name: Set up QEMU
46+
uses: docker/setup-qemu-action@v3
47+
48+
- name: Set up Docker Buildx
49+
uses: docker/setup-buildx-action@v3
50+
51+
- name: >-
52+
Build docker image for
53+
${{ env.ARCH }}
54+
${{ env.VERSION }}
55+
${{ env.VARIANT }}
56+
run: make test
57+
58+
- name: Login to dockerhub
59+
uses: docker/login-action@v3
60+
if: >-
61+
${{
62+
(github.ref == 'refs/heads/master') &&
63+
(github.event_name != 'pull_request')
64+
}}
65+
with:
66+
username: ${{ secrets.DOCKERHUB_USERNAME }}
67+
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}
5668

69+
- name: Push docker image to dockerhub
70+
if: >-
71+
${{
72+
(github.ref == 'refs/heads/master') &&
73+
(github.event_name != 'pull_request')
74+
}}
75+
env:
76+
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
77+
DOCKERHUB_ACCESS_TOKEN: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}
78+
run: make push

Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,12 @@ update:
7676
define build-version
7777
build-$1:
7878
ifeq ($(do_default),true)
79-
$(DOCKER) build --pull -t $(REPO_NAME)/$(IMAGE_NAME):$(shell echo $1) $1
79+
$(DOCKER) build --platform=$(ARCH) --pull -t $(REPO_NAME)/$(IMAGE_NAME):$(shell echo $1) $1
8080
$(DOCKER) images $(REPO_NAME)/$(IMAGE_NAME):$(shell echo $1)
8181
endif
8282
ifeq ($(do_alpine),true)
8383
ifneq ("$(wildcard $1/alpine)","")
84-
$(DOCKER) build --pull -t $(REPO_NAME)/$(IMAGE_NAME):$(shell echo $1)-alpine $1/alpine
84+
$(DOCKER) build --platform=$(ARCH) --pull -t $(REPO_NAME)/$(IMAGE_NAME):$(shell echo $1)-alpine $1/alpine
8585
$(DOCKER) images $(REPO_NAME)/$(IMAGE_NAME):$(shell echo $1)-alpine
8686
endif
8787
endif

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Unless `-e POSTGRES_DB` is passed to the container at startup time, this databas
2020

2121
# Versions (2025-01-23)
2222

23-
Supported architecture: `amd64` (also known as X86-64)"
23+
Supported architectures: `amd64` (also known as X86-64)", `arm64`
2424

2525
Recommended versions for new users are: `postgis/postgis:17-3.5`, `postgis/postgis:16-3.5`
2626

0 commit comments

Comments
 (0)