beerpong-elo/Makefile
2025-01-06 01:15:36 +01:00

37 lines
822 B
Makefile

BINARY = beerpong-elo
BUILD_DIR = build
BUILD_ARCH = $(shell go env GOARCH)
BUILD_OS = $(shell go env GOOS)
DOCKER_BUILD_FLAGS =
DOCKER_BUILD_PLATFORM = linux/amd64,linux/arm64,linux/arm32v6,linux/arm32v7
DOCKER_BUILD_TAG = djeeberjr/beerpong-elo
.PHONY: all
all: clean build
.PHONY:build
build: $(BUILD_DIR)/$(BINARY)
$(BUILD_DIR)/$(BINARY):
GOARCH=$(BUILD_ARCH) GOOS=$(BUILD_OS) go build -o $(BUILD_DIR)/$(BINARY) cmd/beerpong-elo.go
.PHONY:clean
clean:
rm -rf $(BUILD_DIR)
.PHONY: dev
dev:
go run cmd/beerpong-elo.go
.PHONY: test
test:
go test ./...
.PHONY: docker-push
docker-push:
docker buildx build $(DOCKER_BUILD_FLAGS) --platform $(DOCKER_BUILD_PLATFORM) -t $(DOCKER_BUILD_TAG) . --push
.PHONY: docker-local
docker-local:
docker buildx build $(DOCKER_BUILD_FLAGS) -t $(DOCKER_BUILD_TAG) . --load