generated from switchboard-xyz/solana-functions-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
29 lines (21 loc) · 897 Bytes
/
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
.PHONY: build clean publish test
# Variables
CARGO_NAME=switchboard # Cargo.toml name
DOCKER_IMAGE_NAME=e17o/my-function # Docker registry image name
DOCKER_BUILD_COMMAND=DOCKER_BUILDKIT=1 docker buildx build --platform linux/amd64 --build-arg CARGO_NAME=${CARGO_NAME}
# Default make task
all: build
docker_build:
${DOCKER_BUILD_COMMAND} --pull -f Dockerfile -t ${DOCKER_IMAGE_NAME} --load ./
docker_publish:
${DOCKER_BUILD_COMMAND} --pull -f Dockerfile -t ${DOCKER_IMAGE_NAME} --push ./
build: docker_build measurement
publish: docker_publish measurement
measurement:
@docker run -d --name my-switchboard-function $(DOCKER_IMAGE_NAME) > /dev/null
@docker cp my-switchboard-function:/measurement.txt measurement.txt
@docker stop my-switchboard-function > /dev/null
@docker rm my-switchboard-function > /dev/null
# Task to clean up the compiled rust application
clean:
cargo clean