31 lines
950 B
Makefile
31 lines
950 B
Makefile
GOCMD=go
|
|
GOBUILD=$(GOCMD) build
|
|
GOCLEAN=$(GOCMD) clean
|
|
GOTEST=$(GOCMD) test
|
|
RELEASE?=$(git tag)
|
|
COMMIT?=$(shell git rev-parse --short HEAD)
|
|
BUILD_TIME?=$(shell date -u '+%Y-%m-%d_%H:%M:%S')
|
|
PROJECT?=bitbucket.org/skeri/heruvym
|
|
GOOS?=linux
|
|
GOARCH?=amd64
|
|
BINARY_NAME=heruvym
|
|
PORT?=1488
|
|
|
|
all: build run
|
|
clean:
|
|
$(GOCLEAN)
|
|
rm -f $(BINARY_NAME)
|
|
build: clean
|
|
CGO_ENABLED=0 GOOS=${GOOS} GOARCH=${GOARCH} $(GOBUILD) \
|
|
-ldflags "-s -w -X ${PROJECT}/version.Release=${RELEASE} \
|
|
-X ${PROJECT}/version.Commit=${COMMIT} -X ${PROJECT}/version.BuildTime=${BUILD_TIME}" \
|
|
-o ${BINARY_NAME}
|
|
container: build
|
|
docker build -t $(BINARY_NAME):$(RELEASE) .
|
|
#run: container
|
|
# docker stop $(BINARY_NAME):$(RELEASE) || true && docker rm $(BINARY_NAME):$(RELEASE)
|
|
test-build:
|
|
CGO_ENABLED=0 $(GOTEST) -c -o ./test/test ./test
|
|
docker compose up --build --force-recreate --force-recreate --remove-orphans
|
|
docker compose down
|