Makefile 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. ifndef SHA
  2. SHA := $(shell git rev-parse HEAD)
  3. endif
  4. ASSETS := \
  5. internal/ui/assets/edit/index.html \
  6. internal/ui/assets/index.html
  7. .PHONY: all clean develop
  8. all: bin/go
  9. bin/go: cmd/go/main.go $(ASSETS) $(shell find internal -name '*.go')
  10. go build -o $@ ./cmd/go
  11. bin/devserver: cmd/devserver/main.go $(ASSETS)
  12. go build -o $@ ./cmd/devserver
  13. node_modules/.build: package.json
  14. npm install
  15. touch $@
  16. internal/ui/assets/edit/index.html: node_modules/.build $(shell find ui -type f)
  17. npm run build
  18. internal/ui/assets/index.html: node_modules/.build $(shell find ui -type f)
  19. npm run build
  20. develop: bin/devserver bin/go
  21. bin/devserver
  22. clean:
  23. rm -rf bin internal/ui/assets
  24. bin/buildimg:
  25. GOBIN="$(CURDIR)/bin" go install github.com/kellegous/buildimg@latest
  26. bin/publish: cmd/publish/main.go
  27. go build -o $@ ./cmd/publish
  28. publish: bin/publish
  29. bin/publish \
  30. --tag=latest \
  31. --tag=$(shell git rev-parse --short $(SHA))
  32. --platform=linux/arm64 \
  33. --platform=linux/amd64 \
  34. --build-arg=SHA=${SHA} \
  35. --image=kellegous/go