-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile.docker
More file actions
53 lines (47 loc) · 1.52 KB
/
Copy pathMakefile.docker
File metadata and controls
53 lines (47 loc) · 1.52 KB
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
DIRS += $(shell find */* -maxdepth 0 -name Makefile -exec dirname "{}" \;)
.PHONY: build
build: check-go-mod
@if [ -z "$(VERSION)" ]; then echo "ERROR: no VERSION set and no git tag found — set VERSION=vX.Y.Z or create a tag" >&2; exit 1; fi
DOCKER_BUILDKIT=1 \
docker build \
--pull \
--no-cache \
--rm=true \
--platform=linux/amd64 \
--build-arg DOCKER_REGISTRY=$(DOCKER_REGISTRY) \
--build-arg BUILD_GIT_VERSION=$$(git describe --tags --always --dirty) \
--build-arg BUILD_GIT_COMMIT=$$(git rev-parse --short HEAD) \
--build-arg BUILD_DATE=$$(date -u +%Y-%m-%dT%H:%M:%SZ) \
-t $(DOCKER_REGISTRY)/$(IMAGE):$(VERSION) \
-f Dockerfile .
.PHONY: check-go-mod
check-go-mod:
@if [ -f "go.mod" ]; then \
echo "go.mod found, running go mod vendor..."; \
go mod vendor; \
else \
echo "go.mod not found, skipping go mod vendor."; \
fi
.PHONY: upload
upload:
docker push $(DOCKER_REGISTRY)/$(IMAGE):$(VERSION)
.PHONY: clean
clean:
docker rmi $(DOCKER_REGISTRY)/$(IMAGE):$(VERSION) || true
docker image prune -f || true
docker builder prune --all -f || true
rm -rf vendor
.PHONY: apply
apply:
@for i in $(DIRS); do \
cd $$i; \
echo "apply $${i}"; \
make apply; \
cd ..; \
done
# Operator-run publish to Docker Hub (requires `docker login`). CI runs
# `make precommit`, never `buca`, so the unconditional push is safe. `apply` is a
# no-op placeholder (no k8s in this repo — deployment lives in the quant config
# repo as a Config CR). Shape mirrors bborbe/kafka-topic-reader.
.PHONY: buca
buca: build upload clean apply