commit 93d3ca84f4750d96bae3e752df2dd4d445d6ef6d
parent dd21e40dde5e7338f8f19e0c6f6ccf201a01e965
Author: Vetle Haflan <vetle.haflan@luxsave.com>
Date: Sat, 16 May 2020 17:28:25 +0200
Add info about building in readme
Diffstat:
M | readme.md | | | 37 | ++++++++++++++++++++++++++++++++++++- |
1 file changed, 36 insertions(+), 1 deletion(-)
diff --git a/readme.md b/readme.md
@@ -44,7 +44,7 @@ DELETE /services (TODO)
PUT /services (TODO)
```
-## Suggested use of services
+### Suggested use of services
Tokens can be set to whatever you want, but the suggested approach is to
@@ -69,3 +69,38 @@ else
fi
```
+
+## Building
+
+### Dev mode
+For building development version, run `./dockerdev.sh` to start a docker
+container that builds the Vue application (dev version) automatically upon
+updates. The web. In summary, run these from the repo root:
+
+- Build UI: `cd ui/ ; ./dockerdev.sh`
+- Build and run backend: `go run ./cmd/sermoni`
+
+### Production
+
+(might make a script for this too, eventually)
+
+- Build UI: `npm install && npm run build` in `ui/` directory, assuming `npm`
+ is installed. Can also execute it in an already running dev container:
+ `docker exec -it <container> npm run build`
+
+- Copy the generated go file to the right directory:
+ `cp ui/dist/html.go internal/http/`
+
+- Build static binary:
+
+ ```
+ GOOS=linux GOARCH=amd64 go get -d ./... ; \
+ go build \
+ -ldflags="-w -s" \
+ -o ./sermoni \
+ -tags PRODUCTION \
+ ./cmd/sermoni/
+ ```
+
+**The production build will not work without HTTPS**, because it uses secure
+cookies.