Cleanup Makefile

Rename 'make build' to 'make docker-image' so it's more obvious what it's doing
Initialize git submodules automatically when needed, so users don't need to do it manually
This commit is contained in:
Łukasz Mierzwa
2017-03-23 22:56:17 -07:00
parent 27caf68ffa
commit 9525cbcbe0
3 changed files with 22 additions and 16 deletions

1
.gitignore vendored
View File

@@ -1 +1,2 @@
.build
unsee

View File

@@ -1,14 +1,19 @@
VERSION := $(shell git describe --tags --always --dirty='-dev')
.PHONY: build
build:
.build/deps.ok: .gitmodules
git submodule update --init --recursive
mkdir -p .build
touch $@
.PHONY: docker-image
docker-image:
docker build --build-arg VERSION=$(VERSION) -t unsee:$(VERSION) .
ALERTMANAGER_URI := https://raw.githubusercontent.com/prymitive/alertmanager-demo-api/master
PORT := 8080
.PHONY: demo
demo: build
demo: docker-image
@docker rm -f unsee-dev || true
docker run \
--name unsee-dev \
@@ -18,7 +23,7 @@ demo: build
unsee:$(VERSION)
.PHONY: dev
dev:
dev: .build/deps.ok
go build -v -ldflags "-X main.version=${VERSION:-dev}" && \
DEBUG=true \
ALERTMANAGER_URI=$(ALERTMANAGER_URI) \
@@ -26,7 +31,7 @@ dev:
./unsee
.PHONY: lint
lint:
lint: .build/deps.ok
@golint ./... | (grep -v ^vendor/ || true)
.PHONY: test

View File

@@ -9,9 +9,19 @@ to alert data, therefore safe to be accessed by wider audience.
## Building and running
### Running in dev mode
Requires Go.
make dev
Will compile unsee and run the binary (not using Docker), by default will use
same port and Alertmanager URI as demo mode. This is intended for local
development.
### Build a Docker image
make build
make docker-image
This will build a Docker image from sources.
@@ -27,16 +37,6 @@ variables. Example:
make PORT=5000 ALERTMANAGER_URI=https://alertmanager.unicorn.corp run
### Running in dev mode
Requires Go.
make dev
Will compile unsee and run the binary (not using Docker), by default will use
same port and Alertmanager URI as demo mode. This is intended for testing
changes.
### Environment variables
#### ALERTMANAGER_URI