build: support configurable target architecture
This commit is contained in:
4
Makefile
4
Makefile
@@ -1,5 +1,7 @@
|
||||
WEB_DIR := web
|
||||
SDK_DIR := sdk
|
||||
ARCH ?= $(shell go env GOARCH)
|
||||
GOOS ?= $(shell go env GOOS)
|
||||
|
||||
.PHONY: web-install web-build sdk-install sdk-build build test vet check seed-pet-doctor docker-config docker-up docker-down docker-logs
|
||||
|
||||
@@ -16,7 +18,7 @@ sdk-build:
|
||||
cd $(SDK_DIR) && npm run build
|
||||
|
||||
build: web-build sdk-build
|
||||
go build -o bin/iqudo-top1 .
|
||||
GOOS=$(GOOS) GOARCH=$(ARCH) go build -o bin/iqudo-top1 .
|
||||
|
||||
test:
|
||||
go test ./...
|
||||
|
||||
@@ -11,6 +11,15 @@ make build
|
||||
./bin/iqudo-top1
|
||||
```
|
||||
|
||||
`make build` 默认使用当前 Go 环境的操作系统和架构,也可以显式指定目标架构:
|
||||
|
||||
```bash
|
||||
make build ARCH=amd64
|
||||
make build ARCH=arm64
|
||||
```
|
||||
|
||||
如需交叉编译其他操作系统,可同时设置 `GOOS`,例如 `make build GOOS=linux ARCH=arm64`。
|
||||
|
||||
默认配置位于 `configs/config.yml`,可以通过环境变量覆盖。
|
||||
|
||||
## Docker Compose 运行
|
||||
|
||||
Reference in New Issue
Block a user