forked from opencost/opencost
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
25 lines (21 loc) · 897 Bytes
/
Makefile
File metadata and controls
25 lines (21 loc) · 897 Bytes
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
GO ?= go
SHELL := bash
IMAGE_TAG ?= $(shell ./tools/image-tag)
GIT_REVISION := $(shell git rev-parse --short HEAD)
GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
GIT_LAST_COMMIT_DATE := $(shell git log -1 --date=iso-strict --format=%cd)
# Build flags
VPREFIX := github.com/opencost/opencost/core/pkg/version
GO_LDFLAGS := -X $(VPREFIX).Version=$(IMAGE_TAG) -X $(VPREFIX).GitCommit=$(GIT_REVISION)
GO_FLAGS := -ldflags "-extldflags \"-static\" -s -w $(GO_LDFLAGS)"
IMG ?= rafay-opencost:latest
TS := $(shell /bin/date "+%Y%m%d%H%M%S")
DEV_USER ?= dev
DEV_TAG := registry.${DEV_USER}.rafay-edge.net/rafay/rafay-opencost:$(TS)
.PHONY: go/bin
go/bin:
CGO_ENABLED=0 $(GO) build $(GO_FLAGS) ./cmd/costmodel
build:
docker buildx create --use
docker buildx build --platform=linux/amd64,linux/arm64 --provenance=false --push -t ${DEV_TAG} . --build-arg version=dev
@echo "$(DEV_TAG)"