-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
50 lines (36 loc) · 1.16 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
SHELL=/bin/bash -o pipefail
REPO?=embercsi/ember-csi-operator
TAG?="0.9.0"
GOLANG_FILES:=$(shell find . -name \*.go -print)
pkgs = $(shell go list ./... | grep -v /vendor/ )
all: dep compile build
dep:
go mod vendor
clean:
# Remove all files and directories ignored by git.
git clean -Xfd .
compile: ember-csi-operator
ember-csi-operator: $(GOLANG_FILES)
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build \
-o build/$@ cmd/manager/main.go
build:
ifndef MULTISTAGE_BUILD
docker build -t $(REPO):build . -f build/Dockerfile.build
docker container create --name extract $(REPO):build
docker container cp extract:/go/src/github.com/embercsi/ember-csi-operator/build/ember-csi-operator ./ember-csi-operator
docker container rm -f extract
docker build --no-cache -t $(REPO):$(TAG) -f build/Dockerfile .
rm ./ember-csi-operator
else
docker build -t $(REPO):$(TAG) -f build/Dockerfile.multistage .
endif
push:
docker push $(REPO):$(TAG)
deploy:
oc create -f deploy/00-pre.yaml deploy/01-scc.yaml deploy/02-operator.yaml
undeploy:
oc delete -f deploy/uninstall.yaml
format: go-fmt
go-fmt:
go fmt $(pkgs)
.PHONY: dep all clean compile build push deploy undeploy format