build(Makefile): add/reimplement shell-% and ghci targets
This commit is contained in:
parent
4d19773223
commit
cbf167d197
1
.gitignore
vendored
1
.gitignore
vendored
@ -65,3 +65,4 @@ tunnel.log
|
|||||||
**/result-*
|
**/result-*
|
||||||
.develop.cmd
|
.develop.cmd
|
||||||
/.vscode
|
/.vscode
|
||||||
|
.ghc/ghci_history
|
||||||
|
|||||||
33
Makefile
33
Makefile
@ -113,6 +113,11 @@ start:
|
|||||||
%-uniworxdb: SERVICE_VARIANT=uniworxdb
|
%-uniworxdb: SERVICE_VARIANT=uniworxdb
|
||||||
%-uniworxdb: CONTAINER_CMD=localhost/fradrive/backend
|
%-uniworxdb: CONTAINER_CMD=localhost/fradrive/backend
|
||||||
|
|
||||||
|
.PHONY: %-ghci
|
||||||
|
%-ghci: SERVICE=backend
|
||||||
|
%-ghci: SERVICE_VARIANT=ghci
|
||||||
|
%-ghci: CONTAINER_CMD=localhost/fradrive/backend
|
||||||
|
|
||||||
.PHONY: %-hoogle
|
.PHONY: %-hoogle
|
||||||
%-hoogle: SERVICE=backend
|
%-hoogle: SERVICE=backend
|
||||||
%-hoogle: SERVICE_VARIANT=hoogle
|
%-hoogle: SERVICE_VARIANT=hoogle
|
||||||
@ -175,6 +180,16 @@ lint-%: CF_PREFIX = lint-
|
|||||||
lint-%: CONTAINER_ATTACHED = true
|
lint-%: CONTAINER_ATTACHED = true
|
||||||
lint-%: --act ;
|
lint-%: --act ;
|
||||||
|
|
||||||
|
.PHONY: shell-%
|
||||||
|
# HELP(shell-$SERVICE): launch (bash) shell inside a new $SERVICE container
|
||||||
|
shell-%: JOB=shell
|
||||||
|
shell-%: CF_PREFIX=shell-
|
||||||
|
shell-%: CONTAINER_ATTACHED=true
|
||||||
|
shell-%: --act ;
|
||||||
|
.PHONY: ghci
|
||||||
|
# HELP: launch new backend instance and enter interactive ghci shell (WIP)
|
||||||
|
ghci: shell-ghci;
|
||||||
|
|
||||||
--act: --develop_containerized;
|
--act: --develop_containerized;
|
||||||
|
|
||||||
--develop_%: PORTS = $(foreach PORT,$(BASE_PORTS),$(shell utils/next_free_port.pl $(PORT)))
|
--develop_%: PORTS = $(foreach PORT,$(BASE_PORTS),$(shell utils/next_free_port.pl $(PORT)))
|
||||||
@ -299,6 +314,13 @@ well-known: static;
|
|||||||
AVSPASS=${AVSPASS:-nopasswordset} ; \
|
AVSPASS=${AVSPASS:-nopasswordset} ; \
|
||||||
stack exec uniworxdb -- $(UNIWORXDB_OPTS)
|
stack exec uniworxdb -- $(UNIWORXDB_OPTS)
|
||||||
|
|
||||||
|
--shell-ghci:
|
||||||
|
stack exec -- ghci
|
||||||
|
# --main-is uniworx:exe:uniworx
|
||||||
|
|
||||||
|
--shell-%:
|
||||||
|
/bin/bash
|
||||||
|
|
||||||
# HELP(start-minio): start minio service
|
# HELP(start-minio): start minio service
|
||||||
|
|
||||||
.PHONY: status
|
.PHONY: status
|
||||||
@ -324,21 +346,16 @@ log-%:
|
|||||||
.PHONY: enter
|
.PHONY: enter
|
||||||
# HELP: launch (bash) shell inside a currently running container. Use ./enter shell wrapper for more convenient usage, possibly with tab-completion in the future
|
# HELP: launch (bash) shell inside a currently running container. Use ./enter shell wrapper for more convenient usage, possibly with tab-completion in the future
|
||||||
enter: --ensure-develop
|
enter: --ensure-develop
|
||||||
$(MAKE) -- --shell
|
$(MAKE) -- --enter
|
||||||
|
|
||||||
.PHONY: psql
|
.PHONY: psql
|
||||||
# HELP: enter psql (postgresql) cli inside a currently running database container
|
# HELP: enter psql (postgresql) cli inside a currently running database container
|
||||||
psql: ENTRYPOINT=/usr/bin/psql -d uniworx
|
psql: ENTRYPOINT=/usr/bin/psql -d uniworx
|
||||||
psql: EXEC_OPTS=--user postgres
|
psql: EXEC_OPTS=--user postgres
|
||||||
psql: --ensure-develop
|
psql: --ensure-develop
|
||||||
$(MAKE) -- --shell CONTAINER_FILE=develop/`cat develop/.current`/start-postgres
|
$(MAKE) -- --enter CONTAINER_FILE=develop/`cat develop/.current`/start-postgres
|
||||||
|
|
||||||
.PHONY: ghci
|
--enter:
|
||||||
# HELP: launch new backend instance and enter interactive ghci shell (WIP)
|
|
||||||
ghci: ENTRYPOINT=stack ghci
|
|
||||||
ghci: --shell;
|
|
||||||
|
|
||||||
--shell:
|
|
||||||
CONTAINER_ID=`cat $(CONTAINER_FILE) | grep 'CONTAINER_ID=' | sed 's/CONTAINER_ID=//'` ; \
|
CONTAINER_ID=`cat $(CONTAINER_FILE) | grep 'CONTAINER_ID=' | sed 's/CONTAINER_ID=//'` ; \
|
||||||
$(CONTAINER_COMMAND) exec -it $(EXEC_OPTS) $${CONTAINER_ID} $(if $(ENTRYPOINT),$(ENTRYPOINT),/bin/bash)
|
$(CONTAINER_COMMAND) exec -it $(EXEC_OPTS) $${CONTAINER_ID} $(if $(ENTRYPOINT),$(ENTRYPOINT),/bin/bash)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user