-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
33 lines (26 loc) · 973 Bytes
/
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
VERSION ?= $(shell git describe --tags --always )
TARGET := $(shell basename `git rev-parse --show-toplevel`)
TEST ?= $(shell go list ./... | grep -v /vendor/)
REPOSITORY := mattdeboer/etcdcd
DOCKER_IMAGE = ${REPOSITORY}:${VERSION}
default: test build
test:
go test -v -cover -run=$(RUN) $(TEST)
build: clean
@go build -v -o bin/$(TARGET) ./pkg/cmd
release: clean
CGO_ENABLED=0 GOARCH=amd64 GOOS=linux go build \
-a -tags netgo \
-a -installsuffix cgo \
-ldflags "-s -X main.Version=$(VERSION) -X main.Name=$(TARGET)" \
-o bin/$(TARGET) ./pkg/cmd
ca-certificates.crt:
@-docker rm -f etcdcd_cacerts
@docker run --name etcdcd_cacerts debian:latest bash -c 'apt-get update && apt-get install -y ca-certificates'
@docker cp etcdcd_cacerts:/etc/ssl/certs/ca-certificates.crt .
@docker rm -f etcdcd_cacerts
docker: ca-certificates.crt
@echo "Building ${DOCKER_IMAGE}..."
@docker build -t ${DOCKER_IMAGE} .
clean:
@rm -rf bin/