2019-11-17 00:06:09 +00:00
|
|
|
SHELL := bash # the shell used internally by "make"
|
|
|
|
|
2019-09-10 16:18:39 +00:00
|
|
|
# These default settings can be overriden by exporting env variables
|
|
|
|
|
2019-11-13 01:27:46 +00:00
|
|
|
GIT_REVISION ?= $(shell git rev-parse HEAD)
|
|
|
|
NETWORK ?= testnet1
|
|
|
|
NETWORK_NIM_FLAGS ?= $(shell ../scripts/load-testnet-nim-flags.sh $(NETWORK))
|
2020-02-09 02:22:42 +00:00
|
|
|
# Get the required GCC flags by running `gcc -v -E - -march=native </dev/null 2>&1 | grep cc1` on the server.
|
|
|
|
MARCH_NIM_FLAGS ?= -d:disableMarchNative --passC:'-march=znver1 --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=512'
|
2019-09-10 16:18:39 +00:00
|
|
|
|
|
|
|
IMAGE_TAG ?= $(NETWORK)
|
|
|
|
IMAGE_NAME ?= statusteam/nimbus_beacon_node:$(IMAGE_TAG)
|
|
|
|
|
2019-11-17 00:06:09 +00:00
|
|
|
CURRENT_BRANCH = $(shell git rev-parse --abbrev-ref HEAD)
|
|
|
|
COMPUTER_SAYS_NO = { echo "I'm sorry, Dave. I'm afraid I can't do that."; exit 1; }
|
|
|
|
|
2020-01-29 11:01:41 +00:00
|
|
|
.PHONY: build push push-last
|
|
|
|
|
2019-10-29 00:54:40 +00:00
|
|
|
build:
|
2019-11-17 00:06:09 +00:00
|
|
|
@ DOCKER_BUILDKIT=1 \
|
2019-09-10 16:18:39 +00:00
|
|
|
docker build \
|
|
|
|
--build-arg="GIT_REVISION=$(GIT_REVISION)" \
|
2019-11-13 01:27:46 +00:00
|
|
|
--build-arg="NETWORK_NIM_FLAGS=$(NETWORK_NIM_FLAGS)" \
|
2020-02-09 02:22:42 +00:00
|
|
|
--build-arg="MARCH_NIM_FLAGS=$(MARCH_NIM_FLAGS)" \
|
2019-11-17 00:06:09 +00:00
|
|
|
-t $(IMAGE_NAME) \
|
|
|
|
--progress=plain \
|
|
|
|
.
|
2019-09-10 16:18:39 +00:00
|
|
|
|
|
|
|
push: build
|
2019-11-17 00:06:09 +00:00
|
|
|
+@ $(MAKE) push-last
|
2019-09-10 16:18:39 +00:00
|
|
|
|
2019-11-07 01:32:10 +00:00
|
|
|
push-last:
|
2020-04-08 21:09:52 +00:00
|
|
|
@ [[ "$(CURRENT_BRANCH)" != "master" && "$(NETWORK)" == "testnet0" ]] && $(COMPUTER_SAYS_NO) || true
|
|
|
|
@ [[ "$(CURRENT_BRANCH)" != "devel" && "$(NETWORK)" == "testnet1" ]] && $(COMPUTER_SAYS_NO) || true
|
2019-11-07 01:32:10 +00:00
|
|
|
docker push $(IMAGE_NAME)
|
|
|
|
|