feat: use podman, if available or docker otherwise

doc: update README.md
This commit is contained in:
Settel 2024-02-19 08:09:42 +01:00
parent c60976a06a
commit ae2f0407fa
2 changed files with 39 additions and 17 deletions

View File

@ -1,7 +1,8 @@
TMUX_SESSION=knowyt
VERSION=$(shell grep version client/package.json | cut -d\" -f4)
CONTAINER=$(shell which podman || which docker)
.PHONY: info run-all run-server run-client run-tmux build podman clean
.PHONY: info setup run-all run-server run-client run-tmux build clean
info:
@echo available targets:
@ -9,9 +10,16 @@ info:
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 \
podman newuidmap slirp4netns; do \
newuidmap slirp4netns; do \
echo -n " $$binary: " ; \
if ! which "$$binary"; then \
echo "not found" ;\
@ -50,28 +58,27 @@ build:
echo $(VERSION)
(cd client/ && pnpm run generate)
$(MAKE) -C server build
$(MAKE) podman-build
$(MAKE) podman-save
$(MAKE) container-build
podman-build:
container-build:
mkdir -p build/files/data
cp server/knowyt build/files/
podman build --tag knowyt:$(VERSION) .
$(CONTAINER) build --tag knowyt:$(VERSION) .
podman-save:
container-save:
rm -f build/knowyt-$(VERSION).tar
podman save knowyt:$(VERSION) -o build/knowyt-$(VERSION).tar
$(CONTAINER) 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)
container-run:
$(CONTAINER) run --rm -it -p 8080:32039 -v $$(pwd)/server/data/:/data --name knowyt knowyt:$(VERSION)
podman-stop:
podman stop knowyt
container-stop:
$(CONTAINER) stop knowyt
podman-publish:
podman push knowyt:$(VERSION) docker.io/settel/knowyt:$(VERSION)
podman push knowyt:$(VERSION) docker.io/settel/knowyt:latest
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/

View File

@ -1,6 +1,13 @@
# Know Your Teammates
[Watch video (3:33mins)](https://www.sirlab.de/knowyt/know-your-teammates.mp4)
Know Your Teammates is a free team building game for 3-20 players that can be played in a browser.
It has two phases: during collection phase, the players are asked to enter 3-5 facts about themselves, eg. hobbies, books, movies they enjoy, places they have visited or other fun facts. In play phase, one fact is presented to all players and they have to guess who wrote it. The real fun is in the discussion following it :-)
[Watch video (3:30mins)](https://www.sirlab.de/knowyt/know-your-teammates.mp4)
See Website https://www.sirlab.de/linux/games/knowyt/
## Installation
@ -20,11 +27,19 @@ start client and server in a split terminal window
make run-tmux
```
This will start frontend (port 3000) and backend (port 32039) as two separate services. Hot reload is active, changes will take effect immediately.
## build podman/docker image
Point your browser at [http://localhost:3000/](http://localhost:3000/) to start playing.
## build and run podman/docker image
```
make setup # only needed on first run
make build
make container-run
```