ae2f0407fa
doc: update README.md
92 lines
2.2 KiB
Makefile
92 lines
2.2 KiB
Makefile
TMUX_SESSION=knowyt
|
|
VERSION=$(shell grep version client/package.json | cut -d\" -f4)
|
|
CONTAINER=$(shell which podman || which docker)
|
|
|
|
.PHONY: info setup run-all run-server run-client run-tmux build clean
|
|
|
|
info:
|
|
@echo available targets:
|
|
@perl -ne 'm/^([\w\-]+):/ && print(" $$1\n");' Makefile
|
|
|
|
setup:
|
|
@echo "I checking for tools"
|
|
@echo -n " container: " ; \
|
|
if ! [ -x "$(CONTAINER)" ]; then \
|
|
echo "neither podman nor docker found" ;\
|
|
exit 1 ;\
|
|
else \
|
|
echo "$(CONTAINER)" ;\
|
|
fi
|
|
@for binary in go go-bindata tmux node pnpm npx \
|
|
pexec inotifyloop inotifywait \
|
|
newuidmap slirp4netns; do \
|
|
echo -n " $$binary: " ; \
|
|
if ! which "$$binary"; then \
|
|
echo "not found" ;\
|
|
exit 1 ;\
|
|
fi ;\
|
|
done
|
|
@echo "I installing client dependencies"
|
|
( cd client && pnpm run setup )
|
|
@echo "I create client output directory"
|
|
mkdir -p client/.output/public/
|
|
@echo "I installing server dependencies"
|
|
$(MAKE) -C server setup
|
|
|
|
run-all:
|
|
pexec -R -c -e TARGET \
|
|
-r run-client \
|
|
-r run-server \
|
|
-- $(MAKE) '$$TARGET'
|
|
|
|
run-tmux:
|
|
tmux start-server
|
|
-tmux kill-session -t "$(TMUX_SESSION)"
|
|
tmux new-session -d -s "$(TMUX_SESSION)"
|
|
tmux send-keys "make run-client" C-m
|
|
tmux splitw -v -l 5
|
|
tmux send-keys "make run-server" C-m
|
|
tmux attach-session -t "$(TMUX_SESSION)"
|
|
|
|
run-client:
|
|
(cd client/ && pnpm dev)
|
|
|
|
run-server:
|
|
$(MAKE) -C server run-loop
|
|
|
|
build:
|
|
echo $(VERSION)
|
|
(cd client/ && pnpm run generate)
|
|
$(MAKE) -C server build
|
|
$(MAKE) container-build
|
|
|
|
container-build:
|
|
mkdir -p build/files/data
|
|
cp server/knowyt build/files/
|
|
$(CONTAINER) build --tag knowyt:$(VERSION) .
|
|
|
|
container-save:
|
|
rm -f build/knowyt-$(VERSION).tar
|
|
$(CONTAINER) save knowyt:$(VERSION) -o build/knowyt-$(VERSION).tar
|
|
ls -lh build/knowyt-$(VERSION).tar
|
|
|
|
container-run:
|
|
$(CONTAINER) run --rm -it -p 8080:32039 -v $$(pwd)/server/data/:/data --name knowyt knowyt:$(VERSION)
|
|
|
|
container-stop:
|
|
$(CONTAINER) stop knowyt
|
|
|
|
container-publish:
|
|
$(CONTAINER) push knowyt:$(VERSION) docker.io/settel/knowyt:$(VERSION)
|
|
$(CONTAINER) push knowyt:$(VERSION) docker.io/settel/knowyt:latest
|
|
|
|
clean:
|
|
rm -rf client/.output/
|
|
rm -rf client/.nuxt/
|
|
$(MAKE) -C server clean
|
|
rm -f build/files/knowyt build/knowyt-*.tar
|
|
|
|
reset-data:
|
|
rm -rf server/data/
|
|
git checkout server/data/
|
|
|