add makefile

This commit is contained in:
Henry Dollman
2024-10-29 21:07:16 -04:00
parent 3209c53201
commit 67f88188e1
4 changed files with 59 additions and 5 deletions

View File

@@ -258,13 +258,31 @@ Pausing/unpausing the agent for longer than one minute will result in incomplete
Both the hub and agent are written in Go, so you can easily build them yourself, or cross-compile for different platforms. Please [install Go](https://go.dev/doc/install) first if you haven't already.
### Prepare dependencies
### Using Makefile
Run `make` in `/beszel`. This creates a `build` directory containing the binaries.
```bash
cd beszel && make
```
You can also build for different platforms:
```bash
make OS=freebsd ARCH=arm64
```
See a list of valid options by running `go tool dist list`.
### Manual compilation
#### Prepare dependencies
```bash
cd beszel && go mod tidy
```
### Agent
#### Agent
Go to `beszel/cmd/agent` and run the following command to create a binary in the current directory:
@@ -272,7 +290,7 @@ Go to `beszel/cmd/agent` and run the following command to create a binary in the
CGO_ENABLED=0 go build -ldflags "-w -s" .
```
### Hub
#### Hub
The hub embeds the web UI in the binary, so you must build the website first. I use [Bun](https://bun.sh/), but you may use Node.js if you prefer:
@@ -288,7 +306,7 @@ Then in `beszel/cmd/hub`:
CGO_ENABLED=0 go build -ldflags "-w -s" .
```
### Cross-compiling
#### Cross-compiling
You can cross-compile for different platforms using the `GOOS` and `GOARCH` environment variables.
@@ -298,7 +316,7 @@ For example, to build for FreeBSD ARM64:
GOOS=freebsd GOARCH=arm64 CGO_ENABLED=0 go build -ldflags "-w -s" .
```
You can see a list of valid options by running `go tool dist list`.
See a list of valid options by running `go tool dist list`.
## License