-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMakefile
52 lines (40 loc) · 1.4 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
51
52
prog := star-randsrv
version := $(shell git describe --tag --dirty)
image_tag := $(prog):$(version)
image_tar := $(prog)-$(version)-kaniko.tar
image_eif := $(image_tar:%.tar=%.eif)
RUST_DEPS := $(wildcard Cargo.* src/*.rs)
# RUST_DEPS is approximate; always invoke cargo to update $(prog).
.PHONY: all test lint clean eif image target/release/$(prog)
all: test lint target/release/$(prog)
test:
cargo test
lint:
cargo clippy
cargo audit
target/release/$(prog): Cargo.toml src/*.rs
cargo build --release
clean:
cargo clean
$(RM) $(image_tar)
$(RM) $(image_eif)
eif: $(image_eif)
$(image_eif): $(image_tar)
docker load -i $<
nitro-cli build-enclave --docker-uri $(image_tag) --output-file $@
image: $(image_tar)
$(image_tar): Dockerfile $(RUST_DEPS)
docker run -v $$PWD:/workspace gcr.io/kaniko-project/executor:v1.9.2 \
--context dir:///workspace/ \
--reproducible \
--no-push \
--tarPath $(image_tar) \
--destination $(image_tag) \
--custom-platform linux/amd64
run: $(image_eif)
$(eval ENCLAVE_ID=$(shell nitro-cli describe-enclaves | jq -r '.[0].EnclaveID'))
@if [ "$(ENCLAVE_ID)" != "null" ]; then nitro-cli terminate-enclave --enclave-id $(ENCLAVE_ID); fi
@echo "Starting enclave."
nitro-cli run-enclave --cpu-count 2 --memory 512 --eif-path $(image_eif) --debug-mode
@echo "Showing enclave logs."
nitro-cli console --enclave-id $$(nitro-cli describe-enclaves | jq -r '.[0].EnclaveID')