-
Notifications
You must be signed in to change notification settings - Fork 119
Expand file tree
/
Copy pathMakefile
More file actions
50 lines (42 loc) · 1.5 KB
/
Copy pathMakefile
File metadata and controls
50 lines (42 loc) · 1.5 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
.PHONY: all build-docker docker-push release
include ../scripts/blst-portable.mk
VERSION ?= $(shell git describe --always)
SET_LATEST ?= 0
SET_LATEST := $(shell if [ "$(SET_LATEST)" = "1" ]; then echo 1; else echo 0; fi)
USE_REGISTRY_CACHE ?= 0
ifeq ($(USE_REGISTRY_CACHE),1)
DOCKER_CACHE_ARGS := --cache-from type=registry,ref=ghcr.io/gonka-ai/bridge:buildcache --cache-to type=registry,ref=ghcr.io/gonka-ai/bridge:buildcache,mode=min
DOCKER_BUILD_PREFIX := docker buildx build --load $(DOCKER_CACHE_ARGS)
else
DOCKER_CACHE_ARGS :=
DOCKER_BUILD_PREFIX := DOCKER_BUILDKIT=1 docker build
endif
define DOCKER_BUILD
@echo "--> building bridge docker image"
@echo " platform: $(PLATFORM)"
@$(DOCKER_BUILD_PREFIX) \
--platform $(PLATFORM) \
-f $(DOCKER_FILE) \
. \
-t $(DOCKER_TAG)
endef
all: build-docker
build-docker:
$(eval PLATFORM=$(DOCKER_PLATFORM))
$(eval DOCKER_FILE=Dockerfile)
$(eval DOCKER_TAG=ghcr.io/product-science/bridge:$(VERSION))
$(DOCKER_BUILD)
@if [ "$(SET_LATEST)" = "1" ]; then \
echo "Setting latest tag..."; \
docker tag $(DOCKER_TAG) ghcr.io/product-science/bridge:latest; \
fi
docker-push:
@echo "--> pushing bridge docker image"
@echo "pushing to GitHub Container Registry"
@docker push ghcr.io/product-science/bridge:$(VERSION)
@if [ "$(SET_LATEST)" = "1" ]; then \
echo "Setting latest tag..."; \
docker tag ghcr.io/product-science/bridge:$(VERSION) ghcr.io/product-science/bridge:latest; \
docker push ghcr.io/product-science/bridge:latest; \
fi
release: build-docker