Skip to content

Instantly share code, notes, and snippets.

@alfranz
Last active March 5, 2021 14:36
Show Gist options
  • Save alfranz/9a8d5dcd13cd6dc5fc5ecc8c1dbbb6fa to your computer and use it in GitHub Desktop.
Save alfranz/9a8d5dcd13cd6dc5fc5ecc8c1dbbb6fa to your computer and use it in GitHub Desktop.
Self-documenting Makefile for web projects - inspired by https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
start: ## Start the docker containers
@echo "Starting the docker containers"
@docker-compose up -d
@echo "Containers started - http://localhost:8000"
stop: ## Stop Containers
@docker-compose down
build: ## Build Containers
@docker-compose build
ssh: ## SSH into running web container
docker-compose exec web ash
install: ## Runs npm install in the container
@docker-compose exec web npm install
migrations: ## Run DB migrations in the container
@docker-compose exec web python manage.py makemigrations
build-fe: ## Build the frontend using the container
@docker-compose exec web npm run build
dev-watch: ## Run npm dev-watch in the container
@docker-compose exec web npm run dev-watch
.PHONY: help
.DEFAULT_GOAL := help
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment