[make] Add Makefile

This commit is contained in:
Richard Huang 2022-01-09 17:31:12 -08:00
parent 388c89d96d
commit 761aa20d49
No known key found for this signature in database
GPG key ID: FFDEF81D05C2EC94

25
Makefile Normal file
View file

@ -0,0 +1,25 @@
.PHONY: default run fmt help
default: help
run: ## Run the program
go run server.go
build: Dockerfile ## Build container image
@docker build . -t aeolyus/gull
release: Dockerfile ## Build and push the container image for all platforms
@docker buildx build . \
-t aeolyus/gull \
-t ghcr.io/aeolyus/gull \
--platform linux/arm,linux/arm64,linux/amd64 \
--push
fmt: ## Format the code
go fmt ./...
help: Makefile ## Print this help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) \
| sort \
| awk 'BEGIN {FS = ":.*?## "}; \
{printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'