build(Makefile): add psql target

This commit is contained in:
Sarah Vaupel 2024-10-24 03:44:16 +02:00
parent b46228df26
commit 8302df0563

View File

@ -81,16 +81,12 @@ release:
git commit -m "chore(release): $${VERSION}"
git push
# TODO: rewrite shell targets to enter shell inside currently running containers, do not just launch new containers!
.PHONY: %-shell
# HELP: launches bash-shell inside backend/frontend container
# HELP: launch shell (bash) inside a currently running container
%-shell: ENTRYPOINT=/bin/bash
%-shell: --%-shell;
--%-shell:
MOUNT_DIR=/mnt/fradrive ; \
FRADRIVE_SERVICE=$* ; \
$(MAKE) -- --image-build FRADRIVE_SERVICE=$${FRADRIVE_SERVICE} ; \
$(CONTAINER_FGRUN) -v $(PWD):$${MOUNT_DIR} --env IN_CONTAINER=true --env CONTAINER_FILE=$(CONTAINER_FILE) --entrypoint $(ENTRYPOINT) --name fradrive.$(CURR_DEV).$${FRADRIVE_SERVICE}.shell fradrive/$${FRADRIVE_SERVICE}
$(CONTAINER_COMMAND) exec -it $(EXEC_OPTS) fradrive.$(CURR_DEV).$* $(ENTRYPOINT)
##### GENERAL TARGETS #####
###########################
@ -232,6 +228,12 @@ db: compile-frontend --image-build --containerized---db;
--containerized-%-database: docker/database/initdb.sh docker/database/pg_hba.conf docker/database/postgresql.conf docker/database/schema.sql --image-build
$(MAKE) -- --image-run-$*-database
.PHONY: psql
# HELP: enter psql (postgresql) cli inside a currently running database container
psql: ENTRYPOINT=/usr/bin/psql
psql: EXEC_OPTS=--user postgres
psql: --database-shell;
##### DATABASE TARGETS #####
############################