forked from uselagoon/build-deploy-tool
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
26 lines (20 loc) · 800 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
VERSION=$(shell echo $(shell git describe --abbrev=0 --tags)+$(shell git rev-parse --short=8 HEAD))
BUILD=$(shell date +%FT%T%z)
GO_VER=1.23
GOOS=linux
GOARCH=amd64
PKG=github.com/uselagoon/build-deploy-tool
LDFLAGS=-w -s -X ${PKG}/cmd.bdtVersion=${VERSION} -X ${PKG}/cmd.bdtBuild=${BUILD} -X "${PKG}/cmd.goVersion=${GO_VER}"
test: fmt vet
go clean -testcache && go test -v ./...
fmt:
go fmt ./...
vet:
go vet ./...
run: fmt vet
go run ./main.go
build: fmt vet
CGO_ENABLED=0 go build -ldflags '${LDFLAGS}' -v
docker-build:
DOCKER_BUILDKIT=1 docker build --pull --build-arg GO_VER=${GO_VER} --build-arg VERSION=${VERSION} --build-arg BUILD=${BUILD} --rm -f Dockerfile -t build-deploy-image:local .
docker run --entrypoint /bin/bash build-deploy-image:local -c 'build-deploy-tool version'