-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
47 lines (37 loc) · 1.29 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
GO=go
RACE := $(shell test $$(go env GOARCH) != "amd64" || (echo "-race"))
GOFLAGS=
BIN=bin/mesos-to-cloudwatch
VERSION := $(shell git rev-parse HEAD)
ROOT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
IMAGE="axelspringer/mesos-to-cloudwatch"
all: build/local
help:
@echo 'Available commands:'
@echo
@echo 'Usage:'
@echo ' make restore Install go deps.'
@echo ' make build/local Compile the project.'
@echo ' make test/local Run ginkgo test suites.'
@echo ' make build/docker Create docker container'
@echo ' make clean Clean the directory tree.'
@echo
build/local:
$(GO) get ./...
$(GO) build -ldflags "-X main.Version=$(VERSION)" -o $(BIN) $(GOFLAGS) $(RACE) main.go
deploy/local: build/linux
docker restart `docker ps | grep "/mesos-to-cloudwatch" | awk '{printf $$1}'`
build/linux:
$(GO) get ./...
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GO) build -ldflags "-X main.Version=$(VERSION)" -o "$(BIN)_linux" $(GOFLAGS) main.go
build/docker: build/linux
docker build -t $(IMAGE) .
compose/up: build/linux
docker-compose -f docker-compose.yml up -d
compose/down:
docker-compose -f docker-compose.yml down
push/docker:
echo "$(DOCKER_PASSWORD)" | docker login -u "$(DOCKER_USERNAME)" --password-stdin
docker push $(IMAGE)
restore:
dep ensure