forked from scaleway/scaleway-cloud-controller-manager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
50 lines (37 loc) · 1.39 KB
/
Makefile
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
OS ?= $(shell go env GOOS)
ARCH ?= $(shell go env GOARCH)
ALL_PLATFORM = linux/amd64,linux/arm/v7,linux/arm64
BUILD_DATE ?= $(shell date -Is)
GOPATH ?= $(GOPATH)
REGISTRY ?= scaleway
IMAGE ?= scaleway-cloud-controller-manager
FULL_IMAGE ?= $(REGISTRY)/$(IMAGE)
TAG ?= $(shell git rev-parse HEAD)
IMAGE_TAG ?= $(shell git rev-parse HEAD)
COMMIT_SHA ?= $(shell git rev-parse HEAD)
DOCKER_CLI_EXPERIMENTAL ?= enabled
.PHONY: default
default: test compile
.PHONY: clean
clean:
go clean -i -x ./...
.PHONY: test
test:
go test -timeout=1m -v -race -short ./...
.PHONY: fmt
fmt:
find . -type f -name "*.go" | grep -v "./vendor/*" | xargs gofmt -s -w -l
.PHONY: compile
compile:
go build -v -o scaleway-cloud-controller-manager ./cmd/scaleway-cloud-controller-manager
.PHONY: docker-build
docker-build:
@echo "Building scaleway-cloud-controller-manager for ${ARCH}"
docker build . --platform=linux/$(ARCH) --build-arg ARCH=$(ARCH) --build-arg TAG=$(TAG) --build-arg COMMIT_SHA=$(COMMIT_SHA) --build-arg BUILD_DATE=$(BUILD_DATE) -f Dockerfile -t ${FULL_IMAGE}:${IMAGE_TAG}-$(ARCH)
.PHONY: docker-buildx-all
docker-buildx-all:
@echo "Making release for tag $(IMAGE_TAG)"
docker buildx build --build-arg TAG=$(TAG) --build-arg COMMIT_SHA=$(COMMIT_SHA) --build-arg BUILD_DATE=$(BUILD_DATE) --platform=$(ALL_PLATFORM) --push -t $(FULL_IMAGE):$(IMAGE_TAG) .
## Release
.PHONY: release
release: docker-buildx-all