Remove debug information and dot files from production build #58

This commit is contained in:
Michael Mayer 2018-11-09 11:41:07 +01:00
parent 18f88b8a2f
commit 9001075512
2 changed files with 13 additions and 7 deletions

View file

@ -16,7 +16,7 @@ DOCKER_TAG=`date -u +%Y%m%d`
all: download dep js build
install: install-bin install-assets install-config
install-bin:
cp $(BINARY_NAME) /usr/local/bin/$(BINARY_NAME)
scripts/build.sh install /usr/local/bin/$(BINARY_NAME)
install-assets:
mkdir -p /srv/photoprism
mkdir -p /srv/photoprism/photos
@ -25,11 +25,12 @@ install-assets:
cp -r assets/public /srv/photoprism
cp -r assets/templates /srv/photoprism
cp -r assets/tensorflow /srv/photoprism
find /srv/photoprism -name '.*' -type f -delete
install-config:
mkdir -p /etc/photoprism
test -e /etc/photoprism/photoprism.yml || cp -n configs/photoprism.yml /etc/photoprism/photoprism.yml
build:
scripts/build.sh
scripts/build.sh debug $(BINARY_NAME)
js:
(cd frontend && yarn install --frozen-lockfile --prod)
(cd frontend && env NODE_ENV=production npm run build)

View file

@ -3,12 +3,17 @@
VERSION=`date -u +0.%Y%m%d.%H%M%S`
BRANCH=`git rev-parse --abbrev-ref HEAD`
if [ ${BRANCH} == "master" ]; then
echo "Building production binary..."
go build -ldflags "-s -w -X main.version=${VERSION}" cmd/photoprism/photoprism.go
if [ -z "$1" ] || [ -z "$2" ]; then
echo "Please provide build mode and output file name" 1>&2
exit 1
fi
if [ $1 == "debug" ]; then
echo "Building development binary..."
go build -ldflags "-X main.version=${VERSION}-${BRANCH}" -o $2 cmd/photoprism/photoprism.go
echo "Done."
else
echo "Building development binary..."
go build -ldflags "-X main.version=${VERSION}-${BRANCH}" cmd/photoprism/photoprism.go
echo "Building production binary..."
go build -ldflags "-s -w -X main.version=${VERSION}" -o $2 cmd/photoprism/photoprism.go
echo "Done."
fi