forked from FabrizioCafolla/lumen-microservice
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
executable file
·92 lines (67 loc) · 1.79 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
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
.PHONY: help
help: ## helper
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//'
.DEFAULT_GOAL := help
CONF ?= ./.env
VERSION = "1.0"
version: ## version
@echo ${VERSION}
##
ifeq ($(shell test -e $(CONF) && echo -n yes),yes)
include $(CONF)
export $(shell sed 's/=.*//' $(CONF))
TAG = "latest"
DB_HOST = ""
DB_NAME = ""
DB_USER = ""
DB_PASS = ""
image_build: ## build immagine
@docker build --tag "$(IMAGENAME):$(TAG)" \
--quiet \
--no-cache \
--target="pro" \
--build-arg ENV=$(ENV) \
--build-arg APPNAME=$(APPNAME) \
--build-arg DOMAIN=$(DOMAIN) \
--build-arg WORKDIR_USER=$(WORKDIR_USER) \
--build-arg WORKDIR_GROUP=$(WORKDIR_GROUP) \
--build-arg WORKDIRPATH=$(WORKDIRPATH) \
--build-arg DB_HOST=$(DB_HOST) \
--build-arg DB_NAME=$(DB_NAME) \
--build-arg DB_USER=$(DB_USER) \
--build-arg DB_PASS=$(DB_PASS) \
$(DOCKERFILE_PATH)
image_push: ## publish image
@docker push "$(IMAGENAME):$(TAG)"
## ENV: DEV
ifeq ($(ENV),dev)
down: ## down containers
@docker-compose down
up: ## up -d containers
@docker-compose up -d
build: # build containers
@docker-compose build
exec: ## enter in app container
@docker exec -it $(APPNAME) /bin/bash
exec_mysql: ## enter in mysql container
@docker exec -it mysql /bin/bash
ssh_setup:
./setup.sh --ssh-setup
ssh_root: ## connessione ssh con l'utenza root o sudoers
@ssh -i $(SSHKEY) $(SRV_USER)@$(SRV_HOST)
ssh: ## connessione ssh con l'utente proprietario della workdir
@ssh -i $(SSHKEY) $(SRV_USER_WK)@$(SRV_HOST)
deploy: down build up ## rebuild containers
endif
endif
##
## APP NON CONFIGURATA
ifneq ($(shell test -e $(CONF) && echo -n yes),yes)
setup: #first install
@chmod +x ./setup.sh
@./setup.sh
manual: ## manuale configurazione
@echo "read Readme.md"
@echo "Missing .env file"
endif
##