forked from Infinidat/infinibox-csi-driver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
executable file
·75 lines (56 loc) · 1.84 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# Go parameters
GOCMD=go
GOBUILD=$(GOCMD) build
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test
GOMOD=$(GOCMD) mod
REDHAT_REPO=scan.connect.redhat.com
BINARY_NAME=infinibox-csi-driver
DOCKER_IMAGE=infinidat-csi-driver
# For Development Build #################################################################
# Docker.io username and tag
DOCKER_USER=user1
DOCKER_IMAGE_TAG=test1
# redhat username and tag
REDHAT_DOCKER_USER=user1
REDHAT_DOCKER_IMAGE_TAG=rhtest1
# For Development Build #################################################################
# For Production Build ##################################################################
ifeq ($(env),prod)
# For Production
# Do not change following values unless change in production version or username
#For docker.io
DOCKER_USER=infinidat
DOCKER_IMAGE_TAG=1.1.0
# For scan.connect.redhat.com
REDHAT_DOCKER_USER=ospid-956ccd64-1dcf-4d00-ba98-336497448906
REDHAT_DOCKER_IMAGE_TAG=1.1.0
endif
# For Production Build ##################################################################
clean:
$(GOCLEAN)
rm -f $(BINARY_NAME)
build:
$(GOBUILD) -o $(BINARY_NAME) -v
test:
$(GOTEST) -v ./...
run:
$(GOBUILD) -o $(BINARY_NAME) -v ./...
./$(BINARY_NAME)
modverify:
$(GOMOD) verify
modtidy:
$(GOMOD) tidy
moddownload:
$(GOMOD) download
# Cross compilation
build-linux:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GOBUILD) -o $(BINARY_NAME) -v
docker-build:
docker build -t $(DOCKER_USER)/$(DOCKER_IMAGE):$(DOCKER_IMAGE_TAG) -f Dockerfile .
docker build -t $(REDHAT_REPO)/$(REDHAT_DOCKER_USER)/$(DOCKER_IMAGE):$(REDHAT_DOCKER_IMAGE_TAG) -f Dockerfile-ubi .
docker-push:
docker push $(DOCKER_USER)/$(DOCKER_IMAGE):$(DOCKER_IMAGE_TAG)
docker push $(REDHAT_REPO)/$(REDHAT_DOCKER_USER)/$(DOCKER_IMAGE):$(REDHAT_DOCKER_IMAGE_TAG)
buildlocal: build docker-build clean
all: build docker-build docker-push clean