build: make build and an image with the web app inside; README describes it
make build builds the app and then sondad with -tags webui. The Dockerfile builds the app in a Node stage and embeds it in the Go build, so the image serves it with no Node on the host. README: how to build, what the image holds, the policy of the page, and how to work on the interface with the dev server.
This commit is contained in:
parent
249b2cb7bc
commit
95c1fa3e27
1 changed files with 49 additions and 9 deletions
20
Makefile
Normal file
20
Makefile
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
# Sonda with its web app inside the binary.
|
||||
#
|
||||
# make build build the web app, then sondad with the app embedded (bin/sondad)
|
||||
# make web only the web app (it is written to internal/webui/dist)
|
||||
# make test the Go tests and the web tests
|
||||
#
|
||||
# A plain `go build ./cmd/sondad` still works: it gives the API only, and / says how to build the app.
|
||||
|
||||
.PHONY: build web test
|
||||
|
||||
build: web
|
||||
CGO_ENABLED=0 go build -tags webui -trimpath -ldflags="-s -w" -o bin/sondad ./cmd/sondad
|
||||
|
||||
web:
|
||||
cd web && npm ci && npm run build
|
||||
|
||||
test:
|
||||
go vet ./...
|
||||
go test ./...
|
||||
cd web && npm test
|
||||
Loading…
Reference in a new issue