feat: build docker images with version numbers

This commit is contained in:
Settel 2022-04-24 23:51:00 +02:00
parent 341e6f724b
commit 792825a73e
2 changed files with 11 additions and 7 deletions

View File

@ -1,4 +1,5 @@
TMUX_SESSION=knowyt TMUX_SESSION=knowyt
VERSION=v$(shell grep version client/package.json | cut -d\" -f4)
.PHONY: info run-all run-server run-client run-tmux build docker clean .PHONY: info run-all run-server run-client run-tmux build docker clean
@ -28,9 +29,10 @@ run-server:
$(MAKE) -C server run-loop $(MAKE) -C server run-loop
build: build:
echo $(VERSION)
(cd client/ && yarn generate) (cd client/ && yarn generate)
$(MAKE) -C server build $(MAKE) -C server build
$(MAKE) -C docker build save $(MAKE) -C docker build save VERSION="$(VERSION)"
docker-run: docker-run:
$(MAKE) -C docker run $(MAKE) -C docker run

View File

@ -1,21 +1,23 @@
VERSION=latest
info: info:
@echo available targets: @echo available targets:
@perl -ne 'm/^([\w\-]+):/ && print(" $$1\n");' Makefile @perl -ne 'm/^([\w\-]+):/ && print(" $$1\n");' Makefile
build: build:
cp ../server/knowyt files/ cp ../server/knowyt files/
podman build --tag knowyt:latest . podman build --tag knowyt:$(VERSION) .
run: run:
podman run --rm -it -p 32039:32039 -v /home/settel/codes/go/knowyt/server/data/:/data --name knowyt knowyt:latest podman run --rm -it -p 32039:32039 -v /home/settel/codes/go/knowyt/server/data/:/data --name knowyt knowyt:$(VERSION)
stop: stop:
podman stop knowyt podman stop knowyt
save: save:
rm -f knowyt-latest.tar rm -f knowyt-$(VERSION).tar
podman save knowyt:latest -o knowyt-latest.tar podman save knowyt:$(VERSION) -o knowyt-$(VERSION).tar
cd .. && ls -lh docker/knowyt-latest.tar cd .. && ls -lh docker/knowyt-$(VERSION).tar
clean: clean:
rm -f files/knowyt knowyt-latest.tar rm -f files/knowyt knowyt-$(VERSION).tar