Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
64 lines (51 loc) · 1.7 KB
/
Copy pathMakefile
File metadata and controls
64 lines (51 loc) · 1.7 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# Copyright 2016 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
SHELL := /bin/bash -euo pipefail
# Use the native vendor/ dependency system
export GO111MODULE := on
GOOS ?= $(shell go env GOOS)
GOARCH ?= $(shell go env GOARCH)
ORG := github.com/zvlb
REPOPATH ?= $(ORG)/config-reloader
DOCKER_IMAGE_NAME ?= zvlb/config-reloader
DOCKER_IMAGE_TAG ?= develop
BINARY=config-reloader
LDFLAGS := -extldflags '-static'
.PHONY: build-local
build-local: clean
GOARCH=$(GOARCH) GOOS=$(GOOS) CGO_ENABLED=0 \
go build -ldflags="$(LDFLAGS)" -o out/$(BINARY) cmd/configreloader/main.go
.PHONY: build
build: clean
GOARCH=amd64 GOOS=linux CGO_ENABLED=0 \
go build -ldflags="$(LDFLAGS)" -o out/$(BINARY) cmd/configreloader/main.go
.PHONY: run
run: build-local
./out/$(BINARY)
.PHONY: clean
clean:
rm -rf ./out
.PHONY: docker
docker: build
docker build --build-arg BINARY=$(BINARY) -t $(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG) .
.PHONY: tag
tag:
docker tag $(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG) $(DOCKER_IMAGE_NAME):$(TAG)
.PHONY: push
push: tag
docker push $(DOCKER_IMAGE_NAME):$(TAG)
.PHONY: release
release:
docker tag $(DOCKER_IMAGE_NAME):$(TAG) $(DOCKER_IMAGE_NAME):latest
docker push $(DOCKER_IMAGE_NAME):latest