build(Makefile): run containers interactively (-it) when serving

This commit is contained in:
Sarah Vaupel 2024-09-15 01:59:08 +02:00
parent 320f848aa9
commit ef66ab1538
2 changed files with 14 additions and 4 deletions

View File

@ -1,6 +1,7 @@
SHELL=bash
export CONTAINER_COMMAND ?= podman
export CONTAINER_INTERACTIVE
export IN_CONTAINER ?= false
export IN_CI ?= false
export WATCH
@ -42,6 +43,7 @@ release:
##### UNIFIED FRONTEND/BACKEND TARGETS #####
.PHONY: serve
serve: CONTAINER_INTERACTIVE=-it
serve:
$(MAKE) serve-database &
$(MAKE) serve-frontend &
@ -74,9 +76,14 @@ test: test-frontend test-backend i18n-check
--compile-frontend: --frontend-dependencies
npx -- webpack --progress $(WATCH)
.PHONY: --serve-frontend
--serve-frontend: WATCH=--watch
--serve-frontend: --compile-frontend;
.PHONY: serve-frontend
serve-frontend: CONTAINER_INTERACTIVE=-it
serve-frontend:
$(MAKE) -- --containerized---compile-frontend WATCH=--watch
# .PHONY: --serve-frontend
# --serve-frontend: WATCH=--watch
# --serve-frontend: --compile-frontend;
.PHONY: --lint-frontend
--lint-frontend: eslint.config.js
@ -135,6 +142,7 @@ well-known/.well-known:
--%-prod-backend: --image-build --containerized-%-backend;
.PHONY: serve-backend
serve-backend: CONTAINER_INTERACTIVE=-it
serve-backend:
DEV_PORT_HTTP=`docker/backend/dev_port.pl 3000 | tee .dev-port-http` \
DEV_PORT_HTTPS=`docker/backend/dev_port.pl 3443 | tee .dev-port-https` \
@ -165,6 +173,7 @@ database: .stack .stack-work.lock compile-backend-prod
stack exec uniworxdb -- $(db)
.PHONY: serve-database
serve-database: CONTAINER_INTERACTIVE=-it
serve-database: --containerized-database
.PHONY: .stack
@ -225,7 +234,7 @@ image-rebuild-%:
if [ "$(IN_CONTAINER)" == "true" ] ; then \
$(MAKE) -- $* ; \
else \
$(CONTAINER_COMMAND) run -v $(PWD):$${MOUNT_DIR} --env IN_CONTAINER=true --env FRADRIVE_MAKE_TARGET=$* fradrive/$(FRADRIVE_SERVICE) ; \
$(CONTAINER_COMMAND) run $(CONTAINER_INTERACTIVE) -v $(PWD):$${MOUNT_DIR} --env IN_CONTAINER=true --env FRADRIVE_MAKE_TARGET=$* fradrive/$(FRADRIVE_SERVICE) ; \
fi
##### CONTAINER TARGETS #####

View File

@ -19,6 +19,7 @@ services:
- *fradrive-mnt
depends_on:
- frontend
stdin_open: true
database:
# image: registry.uniworx.de/fradrive/fradrive/database
# pull_policy: if_not_present