-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
74 lines (57 loc) · 2.47 KB
/
Makefile
File metadata and controls
74 lines (57 loc) · 2.47 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
-include .env
-include .env.local
# Self-Documented Makefile see https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
.DEFAULT_GOAL := help
.PHONY: help
help:
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z0-9_-]+:.*?##/ { printf " \033[36m%-27s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
#######################################################################
##@ [Docker] Build / Infrastructure
#######################################################################
DOCKER_COMPOSE_FILE := "$(PROJECT_PATH_HOST)/docker-compose.yml"
DOCKER_COMPOSE := docker-compose \
--file $(DOCKER_COMPOSE_FILE) \
--project-directory $(PROJECT_PATH_HOST)
# --env-file "$(PROJECT_PATH_HOST)/.env"
DEFAULT_CONTAINER := php
RUN_IN_DOCKER := $(DOCKER_COMPOSE) exec -T $(DEFAULT_CONTAINER)
.PHONY: docker-config
docker-config: ## Validate and view the Compose file.
$(DOCKER_COMPOSE) config
.PHONY: docker-pull
docker-pull: ## Pull service images and run service
$(DOCKER_COMPOSE) pull && \
$(DOCKER_COMPOSE) up --detach --force-recreate $(CONTAINER)
.PHONY: docker-build
docker-build: ## Build all docker images. Build a specific image by providing the service name via: make docker-build CONTAINER=<service>
$(DOCKER_COMPOSE) build --parallel $(CONTAINER) && \
$(DOCKER_COMPOSE) up --detach --force-recreate $(CONTAINER)
.PHONY: docker-down
docker-down: ## Stop all docker containers. To only stop one container, use CONTAINER=<service>
$(DOCKER_COMPOSE) down $(CONTAINER)
#######################################################################
##@ [Application]
#######################################################################
.PHONY: exec
exec: ## Execute a command in a running container
$(RUN_IN_DOCKER) bash
.PHONY: composer
composer: ## Run composer and provide the command via ARGS="command --options"
$(RUN_IN_DOCKER) composer $(ARGS)
.PHONY: console
console: ## Run artisan and provide the command via ARGS="command --options"
$(RUN_IN_DOCKER) console $(ARGS)
.PHONY: lint-container
lint-container:
$(RUN_IN_DOCKER) console lint:container
.PHONY: lint-twig
lint-twig:
$(RUN_IN_DOCKER) console lint:twig
codeclimate: ## Code Climate analysis platform.
docker run \
--interactive --tty --rm \
--env CODECLIMATE_CODE="$PWD" \
--volume "$PWD":/code \
--volume /var/run/docker.sock:/var/run/docker.sock \
--volume /tmp/cc:/tmp/cc \
codeclimate/codeclimate $(BUNDLE_ARGS:-help)