-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
41 lines (31 loc) · 1.13 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
# include .env file and export its env vars
# (-include to ignore error if it does not exist)
-include .env
.PHONY: build clean publish test
# Variables
CARGO_NAME=crate-picking-function # Cargo.toml name
DOCKER_IMAGE_NAME ?= acammm/${CARGO_NAME}
check_docker_env:
ifeq ($(strip $(DOCKERHUB_IMAGE_NAME)),)
$(error DOCKERHUB_IMAGE_NAME is not set)
else
@echo DOCKERHUB_IMAGE_NAME: ${DOCKERHUB_IMAGE_NAME}
endif
# Default make task
all: build
docker_build:
docker buildx build --platform linux/amd64 -f Dockerfile -t ${DOCKER_IMAGE_NAME} --load ./
docker_publish:
docker buildx build --platform linux/amd64 -f Dockerfile -t ${DOCKER_IMAGE_NAME} --push ./
build: docker_build measurement
publish: docker_publish measurement
measurement: check_docker_env
@docker run -d --platform=linux/amd64 -q --name=my-switchboard-function ${DOCKERHUB_IMAGE_NAME}:latest
@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
# Task to clean up the compiled rust application
clean:
cargo clean