knowyt/Makefile
2023-06-04 14:31:02 +02:00

85 lines
2.0 KiB
Makefile

TMUX_SESSION=knowyt
VERSION=$(shell grep version client/package.json | cut -d\" -f4)
.PHONY: info run-all run-server run-client run-tmux build podman clean
info:
@echo available targets:
@perl -ne 'm/^([\w\-]+):/ && print(" $$1\n");' Makefile
setup:
@echo "I checking for tools"
@for binary in go go-bindata tmux node yarn npx \
pexec inotifyloop inotifywait \
podman newuidmap slirp4netns; do \
echo -n " $$binary: " ; \
if ! which "$$binary"; then \
echo "not found" ;\
exit 1 ;\
fi ;\
done
@echo "I installing client dependencies"
( cd client && yarn install )
@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/ && yarn dev)
run-server:
$(MAKE) -C server run-loop
build:
echo $(VERSION)
(cd client/ && yarn generate)
$(MAKE) -C server build
$(MAKE) podman-build
$(MAKE) podman-save
podman-build:
mkdir -p build/files/data
cp server/knowyt build/files/
podman build --tag knowyt:$(VERSION) .
podman-save:
rm -f build/knowyt-$(VERSION).tar
podman save knowyt:$(VERSION) -o build/knowyt-$(VERSION).tar
ls -lh build/knowyt-$(VERSION).tar
podman-run:
podman run --rm -it -p 32039:32039 -v $$(pwd)/server/data/:/data --name knowyt knowyt:$(VERSION)
podman-stop:
podman stop knowyt
podman-publish:
podman push knowyt:$(VERSION) docker.io/settel/knowyt:$(VERSION)
podman 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/