Skip to content

Instantly share code, notes, and snippets.

@santarinto
Last active October 11, 2023 19:44
Show Gist options
  • Save santarinto/8dd2930a7cc763ecefc5ee2ef1f4315b to your computer and use it in GitHub Desktop.
Save santarinto/8dd2930a7cc763ecefc5ee2ef1f4315b to your computer and use it in GitHub Desktop.
beatiful list targets on Makefile
# vim:ft=make
# Makefile
DOCKER_EXEC = @docker-compose exec
ifneq (,$(wildcard ./.env))
include .env
export
endif
.PHONY:
.DEFAULT_GOAL := help
help: ## List all available commands
@echo "Available commands:"
@echo ""
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) | sort
clean: ## Clean all data/logs directories
@rm -rf data/db/pgdata
@echo "Delete DG data for dev environment"
build: ## Build dev and prod containers
@docker-compose build --no-cache --pull
up: ## App DEV up environment
@docker-compose up -d
@echo " "
@echo " Dev Environment is started!"
@echo " "
@echo " Dev host http://localhost:$(BACKEND_PORT)"
logs: ## Show logs from app container
docker-compose logs -f
down: ## App DEV down environment
docker-compose down
dev-composer-install: ## Install composer things
$(DOCKER_EXEC) backend php -d memory_limit=4G -d xdebug.remote_enable=0 -d COMPOSER_NO_DEV=0 /usr/local/bin/composer install
shell: ## Open CLI to backend container
$(DOCKER_EXEC) backend zsh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment