-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
50 lines (40 loc) · 1.38 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
# include .env file and export its env vars
# (-include to ignore error if it does not exist)
-include .env
.PHONY: build publish
# Variables
DOCKERHUB_ORGANIZATION ?= switchboardlabs
NAME = ondo2
VERSION = v2
check_docker_env:
ifeq ($(strip $(DOCKERHUB_ORGANIZATION)),)
$(error DOCKERHUB_ORGANIZATION is not set)
else
@echo DOCKERHUB_ORGANIZATION: ${DOCKERHUB_ORGANIZATION}
endif
# Default make task
all: anchor_sync build
anchor_sync :; anchor keys sync
anchor_build :; anchor build
build: docker_build measurement
build: docker_build measurement
publish: docker_publish measurement
measurement: check_docker_env
@docker run -d --platform=linux/amd64 -q --name=my-switchboard-function \
${DOCKERHUB_ORGANIZATION}/${NAME}:${VERSION} > /dev/null
@docker cp my-switchboard-function:/measurement.txt measurement.txt
@echo -n 'MrEnclve: '
@cat measurement.txt
@docker stop my-switchboard-function > /dev/null
@docker rm my-switchboard-function > /dev/null
docker_build: check_docker_env
docker buildx build --pull --platform linux/amd64 \
-f ./switchboard-functions/usdy_usdc_oracle_function_rust/Dockerfile \
-t ${DOCKERHUB_ORGANIZATION}/${NAME}:${VERSION} \
./
docker_publish: check_docker_env
docker buildx build --pull --platform linux/amd64 \
-f ./switchboard-functions/usdy_usdc_oracle_function_rust/Dockerfile \
-t ${DOCKERHUB_ORGANIZATION}/${NAME}:${VERSION} \
--push \
./