Build: Add flag for debug builds
Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
parent
a74a02c0fa
commit
e8e7dfa7b6
2 changed files with 19 additions and 2 deletions
17
internal/hub/debug.go
Normal file
17
internal/hub/debug.go
Normal file
|
@ -0,0 +1,17 @@
|
|||
//go:build debug
|
||||
// +build debug
|
||||
|
||||
package hub
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/photoprism/photoprism/pkg/clean"
|
||||
)
|
||||
|
||||
func init() {
|
||||
if debugUrl := os.Getenv("PHOTOPRISM_HUB_URL"); debugUrl != "" {
|
||||
log.Infof("config: set hub url to %s", clean.Log(debugUrl))
|
||||
ServiceURL = debugUrl
|
||||
}
|
||||
}
|
|
@ -20,9 +20,9 @@ GO_VER=$($GO_BIN version)
|
|||
echo "Building PhotoPrism ${BUILD_ID} ($1)…"
|
||||
|
||||
if [[ $1 == "debug" ]]; then
|
||||
BUILD_CMD=("$GO_BIN" build -ldflags "-X main.version=${BUILD_ID}-DEBUG" -o "${BUILD_BIN}" cmd/photoprism/photoprism.go)
|
||||
BUILD_CMD=("$GO_BIN" build -tags=debug -ldflags "-X main.version=${BUILD_ID}-DEBUG" -o "${BUILD_BIN}" cmd/photoprism/photoprism.go)
|
||||
elif [[ $1 == "race" ]]; then
|
||||
BUILD_CMD=("$GO_BIN" build -race -ldflags "-X main.version=${BUILD_ID}-DEBUG" -o "${BUILD_BIN}" cmd/photoprism/photoprism.go)
|
||||
BUILD_CMD=("$GO_BIN" build -tags=debug -race -ldflags "-X main.version=${BUILD_ID}-DEBUG" -o "${BUILD_BIN}" cmd/photoprism/photoprism.go)
|
||||
elif [[ $1 == "static" ]]; then
|
||||
BUILD_CMD=("$GO_BIN" build -a -v -ldflags "-linkmode external -extldflags \"-static -L /usr/lib -ltensorflow\" -s -w -X main.version=${BUILD_ID}" -o "${BUILD_BIN}" cmd/photoprism/photoprism.go)
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue