knowyt/Makefile

85 lines
2.0 KiB
Makefile
Raw Normal View History

2021-10-01 14:40:07 +00:00
TMUX_SESSION=knowyt
2022-11-06 08:47:43 +00:00
VERSION=$(shell grep version client/package.json | cut -d\" -f4)
2021-07-29 16:39:27 +00:00
2022-09-25 15:27:34 +00:00
.PHONY: info run-all run-server run-client run-tmux build podman clean
2022-03-09 08:09:13 +00:00
2021-07-29 16:39:27 +00:00
info:
@echo available targets:
@perl -ne 'm/^([\w\-]+):/ && print(" $$1\n");' Makefile
2022-11-06 08:47:43 +00:00
setup:
2022-07-13 08:05:07 +00:00
@echo "I checking for tools"
@for binary in go go-bindata tmux node yarn npx \
pexec inotifyloop inotifywait \
podman newuidmap slirp4netns; do \
2022-07-13 08:05:07 +00:00
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
2022-07-13 08:05:07 +00:00
2021-07-29 16:39:27 +00:00
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)
2021-07-29 16:39:27 +00:00
(cd client/ && yarn generate)
$(MAKE) -C server build
2022-11-06 08:47:43 +00:00
$(MAKE) podman-build
$(MAKE) podman-save
podman-build:
mkdir -p build/files/data
2022-11-06 14:49:05 +00:00
cp server/knowyt build/files/
2022-11-06 08:47:43 +00:00
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
2021-07-29 16:39:27 +00:00
2022-09-25 15:27:34 +00:00
podman-run:
2022-11-18 07:54:35 +00:00
podman run --rm -it -p 32039:32039 -v $$(pwd)/server/data/:/data --name knowyt knowyt:$(VERSION)
2022-03-03 09:29:01 +00:00
2022-11-06 08:47:43 +00:00
podman-stop:
podman stop knowyt
2021-08-04 23:45:31 +00:00
2023-06-04 12:31:02 +00:00
podman-publish:
podman push knowyt:$(VERSION) docker.io/settel/knowyt:$(VERSION)
podman push knowyt:$(VERSION) docker.io/settel/knowyt:latest
2021-08-04 23:45:31 +00:00
clean:
rm -rf client/.output/
2021-08-05 00:22:28 +00:00
rm -rf client/.nuxt/
$(MAKE) -C server clean
2022-11-06 08:47:43 +00:00
rm -f build/files/knowyt build/knowyt-*.tar
2022-10-05 07:40:18 +00:00
reset-data:
rm -rf server/data/
2022-11-06 08:15:37 +00:00
git checkout server/data/