From 0505bd10478dd3aea2bbb38f4506afc7fa9faf56 Mon Sep 17 00:00:00 2001 From: Karl Isenberg Date: Mon, 7 Sep 2015 13:44:39 -0700 Subject: [PATCH] Add `make builder` and `make build-docker` --- Makefile | 16 ++++++++++++++++ README.md | 21 +++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/Makefile b/Makefile index 1ed9e3e..a9e603c 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,12 @@ GOPATH=$(shell cd ../../../.. && pwd) +VERSION=$(shell git describe --long --tags --dirty --always) + +# Apply -dirty version suffix if there are staged or unstaged changes in ./builder +BUILDER_DIRTY=$(shell git diff-files --quiet -- "builder" && git diff-index --quiet --cached HEAD -- "builder" || echo "-dirty") +# Version builder by short commit sha of the builder dir, not the last probe version tag +BUILDER_VERSION=$(shell git rev-list -1 HEAD -- "builder" | cut -c1-7)${BUILDER_DIRTY} + default: all all: restoredeps test build @@ -46,3 +53,12 @@ clean: env: @godep go env + +.PHONY: builder +builder: + @echo "--> Building builder: karlkfi/probe-builder:${BUILDER_VERSION}" + @docker build -t karlkfi/probe-builder:${BUILDER_VERSION} ./builder + +build-docker: + @echo "--> Building probe (in karlkfi/probe-builder:${BUILDER_VERSION})" + @docker run -v "$(shell pwd):/go/src/github.com/karlkfi/probe" karlkfi/probe-builder:${BUILDER_VERSION} diff --git a/README.md b/README.md index f725962..b26b263 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,27 @@ probe -t 1s https://example.com/ The error description will be printed to STDERR. +### Building + +Build locally: + +``` +make +``` + +Build in docker: + +``` +make build-docker +``` + +Build docker builder: + +``` +make builder +``` + + ### TODO 1. Add SSL certificate validation options (currently ignores cert validity).