Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiplatform build #405

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
11 changes: 9 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ IMAGE_NAME ?= postgis
DOCKER=docker
DOCKERHUB_DESC_IMG=peterevans/dockerhub-description:latest

# choice between buildx and build depending on the PLATFORMS variable
ifdef PLATFORMS
BUILD := buildx build --platform $(PLATFORMS)
else
BUILD := build
endif

GIT=git
OFFIMG_LOCAL_CLONE=$(HOME)/official-images
OFFIMG_REPO_URL=https://github.com/docker-library/official-images.git
Expand All @@ -76,12 +83,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) --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) --pull -t $(REPO_NAME)/$(IMAGE_NAME):$(shell echo $1)-alpine $1/alpine
$(DOCKER) images $(REPO_NAME)/$(IMAGE_NAME):$(shell echo $1)-alpine
endif
endif
Expand Down
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,21 @@ This Docker-PostGIS project [is part of the PostGIS group](https://postgis.net/d
* If you have a major change in mind, we kindly ask you to start a discussion about it first.
* After making changes to the templates, please run the `./update.sh` script.

## Building Docker Images

To build the all Docker images on your local machine, run:

```sh
make build
```

To build for a different platform, install `docker buildx` and run:

```sh
export PLATFORMS="linux/arm64,linux/amd64"
make build
```

## Code of Conduct

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