2018-12-29 13:04:17 +00:00
|
|
|
B=\033[0;1m
|
|
|
|
G=\033[0;92m
|
|
|
|
R=\033[0m
|
|
|
|
|
|
|
|
NAME ?= homo
|
|
|
|
|
2020-01-16 07:54:22 +00:00
|
|
|
.PHONY: help attach auto up down deps
|
|
|
|
|
2018-12-29 13:04:17 +00:00
|
|
|
# Show this help prompt
|
|
|
|
help:
|
|
|
|
@echo ' Usage:'
|
|
|
|
@echo ''
|
|
|
|
@echo ' make <target>'
|
|
|
|
@echo ''
|
|
|
|
@echo ' Targets:'
|
|
|
|
@echo ''
|
|
|
|
@awk '/^#/{ comment = substr($$0,3) } comment && /^[a-zA-Z][a-zA-Z0-9_-]+ ?:/{ print " ", $$1, comment }' $(MAKEFILE_LIST) | column -t -s ':' | grep -v 'IGNORE' | sort | uniq
|
|
|
|
|
2020-01-16 07:54:22 +00:00
|
|
|
# Install dependencies
|
|
|
|
deps:
|
|
|
|
@go mod tidy -v
|
|
|
|
@go mod vendor
|
|
|
|
|
2018-12-29 13:04:17 +00:00
|
|
|
# Auto Tillich-Zémor hasher demo
|
2020-01-16 07:54:22 +00:00
|
|
|
auto: down deps
|
2018-12-29 13:04:17 +00:00
|
|
|
@echo "\n${B}${G}build container${R}\n"
|
|
|
|
@time docker build -t poc-demo .
|
|
|
|
@echo "\n${B}${G}Bootup container:${R}\n"
|
|
|
|
@time docker run -d --rm -it --name hash-demo poc-demo:latest sh
|
|
|
|
@bash ./auto.sh
|
2020-01-16 07:54:22 +00:00
|
|
|
@make down
|
2018-12-29 13:04:17 +00:00
|
|
|
|
|
|
|
# Stop demo container
|
|
|
|
down:
|
|
|
|
@echo "\n${B}${G}Stop container${R}\n"
|
2020-01-16 07:54:22 +00:00
|
|
|
@docker kill hash-demo || true
|
|
|
|
@docker rm -f hash-demo || true
|
2018-12-29 13:04:17 +00:00
|
|
|
|
|
|
|
# Run Tillich-Zémor hasher demo
|
2020-01-16 07:54:22 +00:00
|
|
|
up: down deps
|
2018-12-29 13:04:17 +00:00
|
|
|
@echo "\n${B}${G}build container${R}\n"
|
|
|
|
@time docker build -t poc-demo .
|
|
|
|
@echo "\n${B}${G}enter inside container:${R}\n"
|
|
|
|
@time docker run --rm -it --name hash-demo poc-demo:latest sh
|
|
|
|
|
|
|
|
# Attach to existing container
|
|
|
|
attach:
|
|
|
|
@echo "\n${B}${G} attach to hash-container ${R}\n"
|
|
|
|
@time docker exec -it --name hash-demo /bin/sh
|