Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
107 lines (81 loc) · 3.44 KB
/
Copy pathMakefile
File metadata and controls
107 lines (81 loc) · 3.44 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
GO_MODULES := client ec2 nitro-enclave
AWS_NITRO_ROOT_CERT_DIR := .cache/aws-nitro-root
AWS_NITRO_ROOT_CERT := $(AWS_NITRO_ROOT_CERT_DIR)/AWS_NitroEnclaves_Root-G1.pem
AWS_NITRO_ROOT_CERT_ZIP_ENTRY ?= root.pem
ENCLAVE_IMAGE ?= nitro-attestation-enclave:latest
ENCLAVE_EIF ?= nitro-attestation-enclave.eif
ENCLAVE_NAME ?= nitro-attestation-enclave
ENCLAVE_CID ?= 16
ENCLAVE_PORT ?= 5000
ENCLAVE_MEMORY_MIB ?= 512
ENCLAVE_CPU_COUNT ?= 1
NITRO_CLI_BLOBS ?= /usr/share/nitro_enclaves/blobs
NITRO_CLI_ARTIFACTS ?= /tmp/nitro-cli-artifacts
HTTP_ADDR ?= :8080
EC2_DEPLOY_MODE ?= git
.PHONY: hooks-install go-fmt go-fmt-check go-lint go-check nitro-root-cert ec2-server-run enclave-docker-build enclave-eif-build enclave-run enclave-stop enclave-describe ec2-app-deploy ec2-app-sync-deploy infra-init infra-fmt infra-fmt-check infra-validate infra-check infra-plan infra-deploy infra-destroy infra-state infra-urls infra-ssh
hooks-install:
git config core.hooksPath .githooks
go-fmt:
@for module in $(GO_MODULES); do \
echo "golangci-lint fmt $$module"; \
(cd $$module && golangci-lint fmt --config ../.golangci.yml ./...) || exit 1; \
done
go-fmt-check:
@for module in $(GO_MODULES); do \
echo "golangci-lint fmt --diff $$module"; \
(cd $$module && golangci-lint fmt --config ../.golangci.yml --diff ./...) || exit 1; \
done
go-lint:
@for module in $(GO_MODULES); do \
if find $$module -name '*.go' -type f | grep -q .; then \
echo "golangci-lint run $$module"; \
(cd $$module && golangci-lint run --config ../.golangci.yml ./...) || exit 1; \
else \
echo "golangci-lint run $$module skipped: no Go files"; \
fi; \
done
go-check: go-fmt-check go-lint
nitro-root-cert:
mkdir -p $(AWS_NITRO_ROOT_CERT_DIR)
curl -fsSL https://aws-nitro-enclaves.amazonaws.com/AWS_NitroEnclaves_Root-G1.zip -o $(AWS_NITRO_ROOT_CERT_DIR)/AWS_NitroEnclaves_Root-G1.zip
unzip -p $(AWS_NITRO_ROOT_CERT_DIR)/AWS_NitroEnclaves_Root-G1.zip $(AWS_NITRO_ROOT_CERT_ZIP_ENTRY) > $(AWS_NITRO_ROOT_CERT)
shasum -a 256 $(AWS_NITRO_ROOT_CERT)
ec2-server-run:
cd ec2 && ENCLAVE_CID=$(ENCLAVE_CID) ENCLAVE_PORT=$(ENCLAVE_PORT) HTTP_ADDR=$(HTTP_ADDR) go run ./cmd/server
enclave-docker-build:
docker build -f nitro-enclave/Dockerfile -t $(ENCLAVE_IMAGE) .
enclave-eif-build:
mkdir -p $(NITRO_CLI_ARTIFACTS)
NITRO_CLI_BLOBS=$(NITRO_CLI_BLOBS) NITRO_CLI_ARTIFACTS=$(NITRO_CLI_ARTIFACTS) nitro-cli build-enclave --docker-uri $(ENCLAVE_IMAGE) --output-file $(ENCLAVE_EIF)
enclave-run:
nitro-cli run-enclave --enclave-name $(ENCLAVE_NAME) --eif-path $(ENCLAVE_EIF) --memory $(ENCLAVE_MEMORY_MIB) --cpu-count $(ENCLAVE_CPU_COUNT) --enclave-cid $(ENCLAVE_CID)
enclave-stop:
nitro-cli terminate-enclave --enclave-name $(ENCLAVE_NAME)
enclave-describe:
nitro-cli describe-enclaves
ec2-app-deploy:
EC2_DEPLOY_MODE=$(EC2_DEPLOY_MODE) scripts/ec2-app-deploy.sh
ec2-app-sync-deploy:
EC2_DEPLOY_MODE=sync scripts/ec2-app-deploy.sh
infra-init:
terraform -chdir=infra init
infra-fmt:
terraform -chdir=infra fmt
infra-fmt-check:
terraform -chdir=infra fmt -check -recursive
infra-validate:
terraform -chdir=infra validate
infra-check: infra-fmt-check infra-validate infra-state
infra-plan:
terraform -chdir=infra plan
infra-deploy:
terraform -chdir=infra apply
infra-destroy:
terraform -chdir=infra destroy
infra-state:
terraform -chdir=infra state list
infra-urls:
terraform -chdir=infra output -json ec2_attestation_urls | jq -r '.[]'
infra-ssh:
terraform -chdir=infra output -json ssh_commands | jq -r '.[]'