Dev: Add debug command and build flags

This commit is contained in:
Timo Volkmann 2021-09-08 14:32:04 +02:00
parent 7e754e8cfa
commit 5d26325b7d
3 changed files with 7 additions and 1 deletions

View file

@ -41,6 +41,7 @@ upgrade: dep-upgrade-js dep-upgrade
clean-local: clean-local-config clean-local-cache
clean-install: clean-local dep build-js install-bin install-assets
dev: dev-npm dev-go-amd64
debug-go: build-go-remote start-debug
dev-npm:
$(info Upgrading NPM in local dev environment...)
sudo npm update -g npm
@ -123,6 +124,8 @@ build-js:
build-go:
rm -f $(BINARY_NAME)
scripts/build.sh debug $(BINARY_NAME)
build-go-remote:
docker-compose exec -u root photoprism make build-go
build-race:
rm -f $(BINARY_NAME)
scripts/build.sh race $(BINARY_NAME)
@ -135,6 +138,8 @@ build-tensorflow:
build-tensorflow-arm64:
docker build -t photoprism/tensorflow:arm64 docker/tensorflow/arm64
docker run -ti photoprism/tensorflow:arm64 bash
start-debug:
docker-compose exec -u root photoprism dlv --listen=:40000 --headless=true --api-version=2 --accept-multiclient exec ./photoprism start
watch-js:
(cd frontend && env NODE_ENV=development npm run watch)
test-js:

View file

@ -26,6 +26,7 @@ services:
ports:
- "2342:2342" # Web Server (PhotoPrism)
- "2343:2343" # Acceptance Tests
- "40000:40000"
working_dir: "/go/src/github.com/photoprism/photoprism"
volumes:
- ".:/go/src/github.com/photoprism/photoprism"

View file

@ -29,7 +29,7 @@ fi
if [[ $1 == "debug" ]]; then
echo "Building development binary..."
go build -ldflags "-X main.version=${PHOTOPRISM_DATE}-${PHOTOPRISM_VERSION}-${PHOTOPRISM_OS}-${PHOTOPRISM_ARCH}-DEBUG" -o $2 cmd/photoprism/photoprism.go
go build -gcflags="all=-N -l" -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 == "race" ]]; then