build(Makefile): fix shell; introduce enter for launching shells in running containers
This commit is contained in:
parent
b89ed41b5b
commit
80849f8c5e
25
Makefile
25
Makefile
@ -23,6 +23,8 @@ export SERVICE_PARALLEL ?= false
|
||||
export JOB
|
||||
export JOB_ID
|
||||
export CONTAINER_CMD
|
||||
export ENTRYPOINT
|
||||
export EXEC_OPTS
|
||||
|
||||
export BASE_PORTS
|
||||
export UNIWORXDB_OPTS ?= -cf
|
||||
@ -257,17 +259,26 @@ status:
|
||||
log-%:
|
||||
$(CONTAINER_COMMAND) logs --follow `cat $(DEVELOP)/$* | grep CONTAINER_ID= | sed 's/^CONTAINER_ID=//'`
|
||||
|
||||
# TODO: rework shells
|
||||
.PHONY: %-shell
|
||||
# HELP: launch shell (bash) inside a currently running container
|
||||
%-shell: --%_shell;
|
||||
--shell:
|
||||
$(CONTAINER_COMMAND) exec -it $(EXEC_OPTS) fradrive.$(CURR_DEV).$* $(if $(ENTRYPOINT),$(ENTRYPOINT),/bin/bash)
|
||||
.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
|
||||
enter: --ensure-develop
|
||||
$(MAKE) -- --shell
|
||||
|
||||
.PHONY: psql
|
||||
# HELP: enter psql (postgresql) cli inside a currently running database container
|
||||
psql: ENTRYPOINT=/usr/bin/psql -d uniworx
|
||||
psql: EXEC_OPTS=--user postgres
|
||||
psql: --database-shell;
|
||||
psql: --ensure-develop
|
||||
$(MAKE) -- --shell CONTAINER_FILE=develop/`cat develop/.current`/start-postgres
|
||||
|
||||
.PHONY: ghci
|
||||
# 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_COMMAND) exec -it $(EXEC_OPTS) $${CONTAINER_ID} $(if $(ENTRYPOINT),$(ENTRYPOINT),/bin/bash)
|
||||
|
||||
# TODO: rework stops
|
||||
.PHONY: stop
|
||||
|
||||
Loading…
Reference in New Issue
Block a user