Add static build target #83

This commit is contained in:
Michael Mayer 2019-06-22 23:14:30 +02:00
parent 6576f4e2af
commit 1b0b41b824
2 changed files with 10 additions and 2 deletions

View file

@ -48,6 +48,9 @@ build-js:
build-go:
rm -f $(BINARY_NAME)
scripts/build.sh debug $(BINARY_NAME)
build-static:
rm -f $(BINARY_NAME)
scripts/build.sh static $(BINARY_NAME)
watch-js:
(cd frontend && env NODE_ENV=development npm run watch)
test-js:

View file

@ -30,9 +30,14 @@ if [[ $1 == "debug" ]]; then
go build -ldflags "-X main.version=${PHOTOPRISM_DATE}-${PHOTOPRISM_VERSION}-${PHOTOPRISM_OS}-${PHOTOPRISM_ARCH}-DEBUG" -o $2 cmd/photoprism/photoprism.go
du -h $2
echo "Done."
elif [[ $1 == "static" ]]; then
echo "Building static production binary..."
go build -a -v -ldflags "-linkmode external -extldflags \"-static -L /usr/local/lib\" -s -w -X main.version=${PHOTOPRISM_DATE}-${PHOTOPRISM_VERSION}-${PHOTOPRISM_OS}-${PHOTOPRISM_ARCH}" -o $2 cmd/photoprism/photoprism.go
du -h $2
echo "Done."
else
echo "Building production binary..."
echo "Building production binary..."
go build -ldflags "-s -w -X main.version=${PHOTOPRISM_DATE}-${PHOTOPRISM_VERSION}-${PHOTOPRISM_OS}-${PHOTOPRISM_ARCH}" -o $2 cmd/photoprism/photoprism.go
du -h $2
echo "Done."
fi
fi