Created
March 1, 2020 09:58
-
-
Save smellman/e158e7c2c1623b0289eb159646f712d2 to your computer and use it in GitHub Desktop.
docker-postgis #176
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| VERSIONS = $(foreach df,$(wildcard */Dockerfile),$(df:%/Dockerfile=%)) | |
| REPO_NAME ?= postgis | |
| IMAGE_NAME ?= postgis | |
| GIT=git | |
| OFFIMG_LOCAL_CLONE=$(HOME)/official-images | |
| OFFIMG_REPO_URL=https://github.com/docker-library/official-images.git | |
| UNAME := $(shell uname) | |
| build: $(VERSIONS) | |
| all: update build test | |
| test: build test-prepare prepare-homebrew $(foreach version,$(VERSIONS),test-$(version)) | |
| define postgis-version | |
| $1: | |
| docker build --pull -t $(REPO_NAME)/$(IMAGE_NAME):$(shell echo $1) $1 | |
| docker build --pull -t $(REPO_NAME)/$(IMAGE_NAME):$(shell echo $1)-alpine $1/alpine | |
| endef | |
| $(foreach version,$(VERSIONS),$(eval $(call postgis-version,$(version)))) | |
| update: | |
| docker run --rm -v $$(pwd):/work -w /work buildpack-deps ./update.sh | |
| test-prepare: | |
| ifeq ("$(wildcard $(OFFIMG_LOCAL_CLONE))","") | |
| $(GIT) clone $(OFFIMG_REPO_URL) $(OFFIMG_LOCAL_CLONE) --depth 1 | |
| endif | |
| prepare-homebrew: | |
| ifeq ("$(UNAME)","Darwin") | |
| find $(OFFIMG_LOCAL_CLONE) -name "*.sh" | xargs gsed -i "s|#!/bin/bash|#!/usr/local/bin/bash|g" | |
| find $(OFFIMG_LOCAL_CLONE) -name "*.sh" | xargs gsed -i "s|(readlink|(greadlink|g" | |
| endif | |
| define test-version | |
| test-$1: $1 | |
| $(OFFIMG_LOCAL_CLONE)/test/run.sh -c $(OFFIMG_LOCAL_CLONE)/test/config.sh -c test/postgis-config.sh $(REPO_NAME)/$(IMAGE_NAME):$(version) | |
| $(OFFIMG_LOCAL_CLONE)/test/run.sh -c $(OFFIMG_LOCAL_CLONE)/test/config.sh -c test/postgis-config.sh $(REPO_NAME)/$(IMAGE_NAME):$(version)-alpine | |
| endef | |
| $(foreach version,$(VERSIONS),$(eval $(call test-version,$(version)))) | |
| .PHONY: build all test update test-prepare $(VERSIONS) $(foreach version,$(VERSIONS),test-$(version)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment