forked from Colllect/Colllect
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
53 lines (41 loc) · 1.31 KB
/
Copy pathMakefile
File metadata and controls
53 lines (41 loc) · 1.31 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
.DEFAULT_GOAL := help
PWD := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
# SSL
SSL_CERT := $(PWD).docker/.ssl/dev-colllect-io.cert.pem
SSL_KEY := $(PWD).docker/.ssl/dev-colllect-io.key.pem
SSL_KEYS := $(SSL_CERT) $(SSL_KEY)
OPENSSL_CNF := $(PWD).docker/.ssl/openssl.cnf
.PHONY: help
help:
@printf "\033[33mUsage:\033[0m\n make [target] [arg=\"val\"...]\n\n\033[33mTargets:\033[0m\n"
@grep -E '^[-a-zA-Z0-9_\.\/]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[32m%-15s\033[0m %s\n", $$1, $$2}'
.PHONY: init
init: .env ssl-renew build ## Initialize project
.PHONY: ssl-renew
ssl-renew: $(SSL_KEYS)
$(SSL_KEYS): $(OPENSSL_CNF)
openssl req -x509 -sha256 -newkey rsa:4096 -nodes -days 365 \
-subj '/CN=dev.colllect.io' \
-config $(OPENSSL_CNF) \
-keyout $(SSL_KEY) \
-out $(SSL_CERT)
.PHONY: build
build:
docker-compose build --parallel
.PHONY: up
up: build ## Launch the app
docker-compose up --remove-orphans
.PHONY: stop
stop: ## Stop the app
docker-compose stop
.PHONY: down
down: ## Down the app
docker-compose down
.PHONY: reset
reset: down ## Remove all networks, images and volumes
@docker network prune -f
@docker rmi -f $(shell docker images -qa) 2>/dev/null || true
@docker volume rm $(shell docker volume ls -q) 2>/dev/null || true
@echo Done
.env:
cp .env.dist .env