-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
executable file
·75 lines (55 loc) · 2.08 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
.DEFAULT_GOAL := help
SHELL := /bin/bash
COMPOSE_FILE = .deploy/docker-compose.dev.yaml
DOCKER_COMPOSE = docker compose -f $(COMPOSE_FILE)
DOCKER_EXEC = $(DOCKER_COMPOSE) exec app_fpm
# Define environment variables
export COMPOSER_HOME = .docker/composer
export PATH := $(COMPOSER_HOME)/vendor/bin:$(PATH)
# Colors
COLOR_RESET = \033[0m
COLOR_BOLD = \033[1m
COLOR_GREEN = \033[92m
COLOR_CYAN = \033[96m
COLOR_MAGENTA = \033[95m
# Separator
define SEPARATOR
endef
# Help command
help:
@echo -e "$(COLOR_CYAN)Welcome to the club$(COLOR_RESET)"
@echo ""
@echo -e "$(COLOR_BOLD)Available commands:$(COLOR_RESET)"
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " $(COLOR_CYAN)%-20s$(COLOR_RESET) %s\n", $$1, $$2}' $(MAKEFILE_LIST)
init:
docker network create app_network || true
cp .env.example .env
make update
make composer-install
make partisan cmd="migrate:fresh --seed"
update: ## Rebuild and up the prod container
docker compose -f .deploy/docker-compose.dev.yaml up -d --build
shell: ## Start the Docker containers
docker exec -it app_fpm sh
up: ## Start the Docker containers
@$(DOCKER_COMPOSE) up -d
down: ## Stop and remove Docker containers
@$(DOCKER_COMPOSE) down
restart: docker-down docker-up ## Restart Docker containers
logs: ## View Docker container logs
@$(DOCKER_EXEC) tail -f storage/logs/laravel-$(shell date +'%Y-%m-%d').log
docker-logs: ## View Docker container logs
docker logs -f app_fpm
container-logs: ## View Docker container logs
@$(DOCKER_COMPOSE) logs -f
composer-install: ## Install Composer dependencies
@$(DOCKER_EXEC) composer install
composer-update: ## Update Composer dependencies
@$(DOCKER_EXEC) composer update
# Artisan targets
partisan: ## Run an Artisan command (e.g., make partisan cmd="optimize")
@$(DOCKER_EXEC) php artisan $(cmd)
# Artisan targets
migrate: ## Run an Artisan command (e.g., make migrate cmd="fresh")
@$(DOCKER_EXEC) php artisan migrate:$(cmd)
.PHONY: help docker-up docker-down docker-restart docker-logs composer-install composer-update artisan-command octane-start octane-stop test-run lint-run fix