forked from kheeklab/privacyidea-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
37 lines (27 loc) · 1.24 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
LOCAL_DATA_VOLUME=/tmp/privacyidea-data
help: ## Show this help message
@echo "Usage: make [target]"
@echo ""
@echo "Targets:"
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " %-30s %s\n", $$1, $$2}' | sort
build: ## Build image
docker build -t khalibre/privacyidea:dev .
push: ## Push image
docker push khalibre/privacyidea:dev
run: cleanup create_volume secretkey pipepper ## Run test
docker run -p 8080:8080 -ti --name=privacyidea-dev --env-file=secretkey --env-file=pipepper khalibre/privacyidea:dev
create_volume:
mkdir $(LOCAL_DATA_VOLUME)
secretkey:
@echo Creating secretkey
@echo PI_SECRET_KEY=$(shell cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1) > secretkey
pipepper:
@echo Creating pipepper
@echo PI_PEPPER=$(shell cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1) > pipepper
cleanup:
@if docker ps -a | grep -q privacyidea-dev; then docker stop privacyidea-dev || true; fi
@if docker ps -a | grep -q privacyidea-dev; then docker rm privacyidea-dev || true; fi
@if [ -d $(LOCAL_DATA_VOLUME) ]; then sudo rm -rf $(LOCAL_DATA_VOLUME); fi
test:
container-structure-test test --image khalibre/privacyidea:dev --config structure-tests.yaml
.DEFAULT_GOAL := help