Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/crkrenn/makefile with detach #1615

Open
wants to merge 3 commits into
base: edge
Choose a base branch
from

Conversation

crkrenn
Copy link
Collaborator

@crkrenn crkrenn commented Jan 30, 2023

@metasoarous & @ballPointPenguin

I've tested this, and it works as intended.

Please merge when you can. Thanks!

-Chris

- Update Makefile for running in detached mode

[Makefile]
- Add `DOCKER_DETACHED` variable for running in detached mode
- Change `start` and `start-rebuild` commands to use `DOCKER_DETACHED`
[Makefile]
- Change the `docker-compose up` command to `docker-compose up --detach --build`

start-FULL-REBUILD: echo_vars stop rm-ALL ## Remove and restart all Docker containers, volumes, and images where (polis_tag="${TAG}")
docker-compose ${COMPOSE_FILE_ARGS} --env-file ${ENV_FILE} build --no-cache
docker-compose ${COMPOSE_FILE_ARGS} --env-file ${ENV_FILE} down
docker-compose ${COMPOSE_FILE_ARGS} --env-file ${ENV_FILE} up --build
docker-compose ${COMPOSE_FILE_ARGS} --env-file ${ENV_FILE} up --detach --build
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not use ${DOCKER_DETACHED} here as well?

@echo ENV_FILE=${ENV_FILE}
@echo TAG=${TAG}

pull: echo_vars ## Pull most recent Docker container builds (nightlies)
docker-compose ${COMPOSE_FILE_ARGS} --env-file ${ENV_FILE} pull

start: echo_vars ## Start all Docker containers
docker-compose ${COMPOSE_FILE_ARGS} --env-file ${ENV_FILE} up
docker-compose ${COMPOSE_FILE_ARGS} --env-file ${ENV_FILE} up ${DOCKER_DETACHED}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will there be a way to run make start in a non-detached way?
I rarely use --detached in development because I actually want my terminal to fill up with all the output.

@@ -12,20 +7,23 @@ export TAG = $(shell grep -e ^TAG ${ENV_FILE} | awk -F'[=]' '{gsub(/ /,""); prin
export GIT_HASH = $(shell git rev-parse --short HEAD)
export COMPOSE_FILE_ARGS = -f docker-compose.yml -f docker-compose.dev.yml

DETACHED: ## Run docker in "detached" mode (e.g. `make DETACHED start`, etc.)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what the advantage of running make DETACHED start is over running simply docker compose -d up. If the idea is that people can't be bothered to learn the docker cli commands and arguments, I get that, up to a point. But eventually we start to emulate more and more bits of the docker cli arguments in the makefile and it no longer feels simpler than just running docker compose commands "by hand".
That said, I see no reason not to approve this change as it is probably a good default for most users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants