feat: refactor podman build

This commit is contained in:
Settel 2022-11-06 09:47:43 +01:00
parent 1e752467eb
commit eeb48281e4
7 changed files with 44 additions and 35 deletions

View File

@ -2,8 +2,8 @@ pipeline:
frontend: frontend:
image: node:16-alpine image: node:16-alpine
commands: commands:
- ( cd client && yarn install ) # - ( cd client && yarn install )
- ( cd client/ && yarn generate ) # - ( cd client/ && yarn generate )
- mkdir -p client/.output/public/ - mkdir -p client/.output/public/
when: when:
branch: woodpecker branch: woodpecker
@ -17,3 +17,27 @@ pipeline:
- make -C server build - make -C server build
when: when:
branch: woodpecker branch: woodpecker
build-publish:
image: mtvb/drone-kaniko
settings:
reproducible: true
username:
from_secret: docker.private.gnuher.de.username
password:
from_secret: docker.private.gnuher.de.password
repo: knowyt
registry: docker.private.gnuher.de
tags: latest
when:
branch: woodpecker
notify:
image: plugins/matrix
settings:
homeserver: https://matrix.bw-messenger.de/
roomid: wHCOKvEHLUmsNybNwh:matrix.bw-messenger.de
username:
from_secret: matrix.bw-messenger.de.username
password:
from_secret: matrix.bw-messenger.de.password

View File

@ -1,5 +1,5 @@
FROM scratch FROM scratch
EXPOSE 32039 EXPOSE 32039
COPY files . COPY build/files .
CMD ["/knowyt"] CMD ["/knowyt"]

View File

@ -1,5 +1,5 @@
TMUX_SESSION=knowyt TMUX_SESSION=knowyt
VERSION=v$(shell grep version client/package.json | cut -d\" -f4) VERSION=$(shell grep version client/package.json | cut -d\" -f4)
.PHONY: info run-all run-server run-client run-tmux build podman clean .PHONY: info run-all run-server run-client run-tmux build podman clean
@ -7,7 +7,7 @@ info:
@echo available targets: @echo available targets:
@perl -ne 'm/^([\w\-]+):/ && print(" $$1\n");' Makefile @perl -ne 'm/^([\w\-]+):/ && print(" $$1\n");' Makefile
setup setup:
@echo "I checking for tools" @echo "I checking for tools"
@for binary in go tmux node yarn npx podman; do \ @for binary in go tmux node yarn npx podman; do \
echo -n " $$binary: " ; \ echo -n " $$binary: " ; \
@ -48,18 +48,29 @@ build:
echo $(VERSION) echo $(VERSION)
(cd client/ && yarn generate) (cd client/ && yarn generate)
$(MAKE) -C server build $(MAKE) -C server build
$(MAKE) -C podman build save VERSION="$(VERSION)" $(MAKE) podman-build
$(MAKE) podman-save
podman-build:
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:
$(MAKE) -C podman run podman run --rm -it -p 32039:32039 -v $$(PWD)/server/data/:/data --name knowyt knowyt:$(VERSION)
run-standalone: podman-stop:
$(MAKE) -C server run-standalone podman stop knowyt
clean: clean:
rm -rf client/.output/ rm -rf client/.output/
rm -rf client/.nuxt/ rm -rf client/.nuxt/
$(MAKE) -C server clean $(MAKE) -C server clean
rm -f build/files/knowyt build/knowyt-*.tar
reset-data: reset-data:
rm -rf server/data/ rm -rf server/data/

View File

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

View File

@ -20,9 +20,6 @@ run-loop:
-r _run-inotify-restart \ -r _run-inotify-restart \
-- $(MAKE) '$$TARGET' -- $(MAKE) '$$TARGET'
run-standalone:
cd src/ && ../knowyt
_run-endless-loop: _run-endless-loop:
while true; do $(MAKE) run || sleep 3; done while true; do $(MAKE) run || sleep 3; done