-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
49 lines (35 loc) · 944 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
-include .env
PKG = github.com/wodby/wodby-cli
REPO = wodby/wodby-cli
NAME = wodby-cli
GOOS ?= linux
GOARCH ?= amd64
VERSION ?= dev
TAG ?= $(VERSION)
LD_FLAGS = "-s -w -X $(PKG)/pkg/version.VERSION=$(VERSION)"
PLATFORM ?= linux/amd64
default: build
.PHONY: build buildx-build buildx-push test shell package
build:
CGO_ENABLED=0 GOOS=$(GOOS) GOARCH=$(GOARCH) \
go build -ldflags $(LD_FLAGS) -o bin/wodby $(PKG)/cmd/wodby
build-image:
docker build -t $(REPO):$(TAG) ./
buildx-build:
docker buildx build \
--platform $(PLATFORM) \
--build-arg VERSION=$(VERSION) \
-t $(REPO):$(TAG) ./
buildx-push:
docker buildx build \
--platform $(PLATFORM) \
--build-arg VERSION=$(VERSION) \
--push \
-t $(REPO):$(TAG) ./
test:
@bin/wodby version | grep $(VERSION)
shell:
docker run --rm --name $(NAME) $(PARAMS) -ti $(REPO):$(TAG) /bin/bash
package:
mkdir -p dist
tar cvzf dist/wodby-$(GOOS)-$(GOARCH).tar.gz -C bin wodby