-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
69 lines (60 loc) · 2.59 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
LICENSE_HEADER := "//" \
"\n// Licensed to the Apache Software Foundation (ASF) under one" \
"\n// or more contributor license agreements. See the NOTICE file" \
"\n// distributed with this work for additional information" \
"\n// regarding copyright ownership. The ASF licenses this file" \
"\n// to you under the Apache License, Version 2.0 (the" \
"\n// \"License\"); you may not use this file except in compliance" \
"\n// with the License. You may obtain a copy of the License at" \
"\n//" \
"\n// http://www.apache.org/licenses/LICENSE-2.0" \
"\n//" \
"\n// Unless required by applicable law or agreed to in writing," \
"\n// software distributed under the License is distributed on an" \
"\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY" \
"\n// KIND, either express or implied. See the License for the" \
"\n// specific language governing permissions and limitations" \
"\n// under the License." \
"\n"
GO_FILES := $(shell find . -type f -name "*.go")
.PHONY: add-license
add-license:
@for file in $(GO_FILES); do \
echo "Adding license to $$file"; \
tmpfile=$$(mktemp); \
echo $(LICENSE_HEADER) | cat - $$file > $$tmpfile && mv $$tmpfile $$file; \
done
DOCKER_REGISTRY ?= my-registry
DOCKER_REGISTRY_USERNAME ?= your-username
DOCKER_REGISTRY_PASSWORD ?= your-password
IMAGE_NAME := clickhouse-benchmark
IMAGE_VERSION := $(shell sh version.sh)
IMAGE := $(DOCKER_REGISTRY)/$(IMAGE_NAME):$(IMAGE_VERSION)
.PHONY: build
build-push-buildkit:
docker login -u "$(DOCKER_REGISTRY_USERNAME)" -p "$(DOCKER_REGISTRY_PASSWORD)" "$(DOCKER_REGISTRY)"
docker buildx create --use
docker buildx build --platform linux/amd64,linux/arm64 -t "$(IMAGE)" \
--label "branch=$(shell git rev-parse --abbrev-ref HEAD)" \
--label "commit=$(shell git rev-parse HEAD)" \
--label "build-time=$(shell date '+%Y-%m-%d %T%z')" \
--push \
-f build/Dockerfile-arch .
@echo "Docker image built and pushed: $(IMAGE)"
build:
docker build --platform linux/amd64 \
-t "$(IMAGE)" \
--label "branch=$(shell git rev-parse --abbrev-ref HEAD)" \
--label "commit=$(shell git rev-parse HEAD)" \
--label "build-time=$(shell date '+%Y-%m-%d %T%z')" \
-f build/Dockerfile .
build-push:
docker build --platform linux/amd64 \
-t "$(IMAGE)" \
--label "branch=$(shell git rev-parse --abbrev-ref HEAD)" \
--label "commit=$(shell git rev-parse HEAD)" \
--label "build-time=$(shell date '+%Y-%m-%d %T%z')" \
-f build/Dockerfile .
docker login -u "$(DOCKER_REGISTRY_USERNAME)" -p "$(DOCKER_REGISTRY_PASSWORD)" "$(DOCKER_REGISTRY)"
docker push $(IMAGE)
@echo "Docker image built and pushed: $(IMAGE)"