Skip to content

Commit 2931e13

Browse files
authored
Feat: add docker-build makefile (#837)
1 parent 1c7641e commit 2931e13

File tree

3 files changed

+44
-27
lines changed

3 files changed

+44
-27
lines changed

Makefile

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,5 @@
1-
GOLANGCILINT_VERSION ?= 1.49.0
2-
3-
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
4-
ifeq (,$(shell go env GOBIN))
5-
GOBIN=$(shell go env GOPATH)/bin
6-
else
7-
GOBIN=$(shell go env GOBIN)
8-
endif
9-
10-
GLOBAL_GOLANGCILINT := $(shell which golangci-lint)
11-
GOBIN_GOLANGCILINT:= $(shell which $(GOBIN)/golangci-lint)
12-
13-
TIME_LONG = `date +%Y-%m-%d' '%H:%M:%S`
14-
TIME_SHORT = `date +%H:%M:%S`
15-
TIME = $(TIME_SHORT)
16-
17-
BLUE := $(shell printf "\033[34m")
18-
YELLOW := $(shell printf "\033[33m")
19-
RED := $(shell printf "\033[31m")
20-
GREEN := $(shell printf "\033[32m")
21-
CNone := $(shell printf "\033[0m")
22-
23-
INFO = echo ${TIME} ${BLUE}[INFO]${CNone}
24-
WARN = echo ${TIME} ${YELLOW}[WARN]${CNone}
25-
ERR = echo ${TIME} ${RED}[FAIL]${CNone}
26-
OK = echo ${TIME} ${GREEN}[ OK ]${CNone}
27-
FAIL = (echo ${TIME} ${RED}[FAIL]${CNone} && false)
1+
include makefiles/const.mk
2+
include makefiles/build.mk
283

294
.PHONY: golangci
305
golangci:

makefiles/build.mk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Build the docker image
2+
.PHONY: docker-build
3+
docker-build:
4+
docker build --build-arg=VERSION=$(VELAUX_VERSION) --build-arg=GITVERSION=$(GIT_COMMIT) -t $(VELAUX_IMAGE) .

makefiles/const.mk

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
SHELL := /bin/bash
2+
3+
GOLANGCILINT_VERSION ?= 1.49.0
4+
5+
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
6+
ifeq (,$(shell go env GOBIN))
7+
GOBIN=$(shell go env GOPATH)/bin
8+
else
9+
GOBIN=$(shell go env GOBIN)
10+
endif
11+
12+
GLOBAL_GOLANGCILINT := $(shell which golangci-lint)
13+
GOBIN_GOLANGCILINT:= $(shell which $(GOBIN)/golangci-lint)
14+
15+
# VelaUX version
16+
VELAUX_VERSION ?= main
17+
# Repo info
18+
GIT_COMMIT ?= git-$(shell git rev-parse --short HEAD)
19+
GIT_COMMIT_LONG ?= $(shell git rev-parse HEAD)
20+
VELAUX_VERSION_KEY := github.com/kubevela/velaux/version.VelaVersion
21+
VELAUX_GITVERSION_KEY := github.com/kubevela/velaux/version.GitRevision
22+
LDFLAGS ?= "-s -w -X $(VELAUX_VERSION_KEY)=$(VELAUX_VERSION) -X $(VELAUX_GITVERSION_KEY)=$(GIT_COMMIT)"
23+
24+
TIME_LONG = `date +%Y-%m-%d' '%H:%M:%S`
25+
TIME_SHORT = `date +%H:%M:%S`
26+
TIME = $(TIME_SHORT)
27+
28+
BLUE := $(shell printf "\033[34m")
29+
YELLOW := $(shell printf "\033[33m")
30+
RED := $(shell printf "\033[31m")
31+
GREEN := $(shell printf "\033[32m")
32+
CNone := $(shell printf "\033[0m")
33+
34+
INFO = echo ${TIME} ${BLUE}[INFO]${CNone}
35+
WARN = echo ${TIME} ${YELLOW}[WARN]${CNone}
36+
ERR = echo ${TIME} ${RED}[FAIL]${CNone}
37+
OK = echo ${TIME} ${GREEN}[ OK ]${CNone}
38+
FAIL = (echo ${TIME} ${RED}[FAIL]${CNone} && false)

0 commit comments

Comments
 (0)