Skip to content

Commit 4b9e2fd

Browse files
committed
Create first draft of multiplatform build
1 parent 0eb34a5 commit 4b9e2fd

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ jobs:
3232
env:
3333
VERSION: ${{ matrix.postgres }}-${{ matrix.postgis }}
3434
VARIANT: ${{ matrix.variant }}
35+
PLATFORMS: linux/amd64,linux/arm64,linux/arm/v7,linux/386
3536

3637
steps:
3738
- name: Checkout source

Makefile

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,13 @@ IMAGE_NAME ?= postgis
5858
DOCKER=docker
5959
DOCKERHUB_DESC_IMG=peterevans/dockerhub-description:latest
6060

61+
# choice between buildx and build depending on the PLATFORMS variable
62+
ifdef PLATFORMS
63+
BUILD := buildx build --platform $(PLATFORMS)
64+
else
65+
BUILD := build
66+
endif
67+
6168
GIT=git
6269
OFFIMG_LOCAL_CLONE=$(HOME)/official-images
6370
OFFIMG_REPO_URL=https://github.com/docker-library/official-images.git
@@ -76,12 +83,12 @@ update:
7683
define build-version
7784
build-$1:
7885
ifeq ($(do_default),true)
79-
$(DOCKER) build --pull -t $(REPO_NAME)/$(IMAGE_NAME):$(shell echo $1) $1
86+
$(DOCKER) $(BUILD) --pull -t $(REPO_NAME)/$(IMAGE_NAME):$(shell echo $1) $1
8087
$(DOCKER) images $(REPO_NAME)/$(IMAGE_NAME):$(shell echo $1)
8188
endif
8289
ifeq ($(do_alpine),true)
8390
ifneq ("$(wildcard $1/alpine)","")
84-
$(DOCKER) build --pull -t $(REPO_NAME)/$(IMAGE_NAME):$(shell echo $1)-alpine $1/alpine
91+
$(DOCKER) $(BUILD) --pull -t $(REPO_NAME)/$(IMAGE_NAME):$(shell echo $1)-alpine $1/alpine
8592
$(DOCKER) images $(REPO_NAME)/$(IMAGE_NAME):$(shell echo $1)-alpine
8693
endif
8794
endif

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,21 @@ This Docker-PostGIS project [is part of the PostGIS group](https://postgis.net/d
193193
* If you have a major change in mind, we kindly ask you to start a discussion about it first.
194194
* After making changes to the templates, please run the `./update.sh` script.
195195

196+
## Building Docker Images
197+
198+
To build the all Docker images on your local machine, run:
199+
200+
```sh
201+
make build
202+
```
203+
204+
To build for a different platform, install `docker buildx` and run:
205+
206+
```sh
207+
export PLATFORMS="linux/arm64,linux/amd64"
208+
make build
209+
```
210+
196211
## Code of Conduct
197212

198213
see: https://postgis.net/community/conduct/

0 commit comments

Comments
 (0)