You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

38 lines
1010 B

SHELL := /bin/bash
GO ?= go
GO_CMD := CGO_ENABLED=0 $(GO)
GIT_VERSION := $(shell git describe --tags --dirty)
VERSION := $(GIT_VERSION:v%=%)
GIT_COMMIT := $(shell git rev-parse HEAD)
DOCKER_REPO := hacknology.de/projekte/leakybot
DOCKER_TAG := $(shell git rev-parse --short HEAD)
DOCKER_TARGETPLATFORM := linux/arm64
BINARY_NAME := leakybot
.PHONY: all
all: test build-binary
.PHONY: test
test:
$(GO_CMD) test -cover ./...
.PHONY: build-binary
build-binary:
$(GO_CMD) build -tags netgo -ldflags "-w -X main.Version=$(VERSION) -X main.GitCommit=$(GIT_COMMIT)" -o ${BINARY_NAME} .
.PHONY: image
image:
docker buildx build -t "$(DOCKER_REPO):$(DOCKER_TAG)" --load .
.PHONY: image.tar
image.tar:
docker buildx build -t "$(DOCKER_REPO):$(DOCKER_TAG)" --platform $(DOCKER_TARGETPLATFORM) --output=type=docker,dest=image.tar .
.PHONY: all-images
all-images:
docker buildx build -t "$(DOCKER_REPO):$(DOCKER_TAG)" --platform linux/amd64,linux/arm64 --push .
.PHONY: clean
clean:
rm -rf leakybot image.tar