Handle docker compose and docker space compose#85
Handle docker compose and docker space compose#85vandaimer wants to merge 6 commits intomateusoliveira43:mainfrom
Conversation
|
Thanks for the PR @vandaimer 😄 🚀 |
|
|
||
| ROOT="$(dirname $( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P ))" | ||
| $ROOT/docker/env.sh | ||
| . $ROOT/docker/base.sh |
There was a problem hiding this comment.
it is needed to run with .? (same as source, right?)
There was a problem hiding this comment.
docker/base.sh
Outdated
|
|
||
| DOCKER_COMPOSE_BIN="docker-compose" | ||
| DOCKER_COMPOSE_FROM_DOCKER="docker compose" | ||
| DOCKER_COMPOSE="" |
There was a problem hiding this comment.
instead of storing a variable, what you think about echoing the value?
There was a problem hiding this comment.
First, to be honest, not sure if is really needed this line 5, I could remove that.
Second, I can do this here base.sh
if [ -x "$(command -v $DOCKER_COMPOSE_BIN)" ]; then
echo $DOCKER_COMPOSE_BIN
else
echo $DOCKER_COMPOSE_FROM_DOCKER
fiAnd on down.sh and run.sh
DOCKER_COMPOSE=$("$ROOT/docker/base.sh")Works!
My concern with this change is that the file's name is base, and the idea is to add/move more things into it, for example, $ROOT/docker/dockerfile that has been repeated many times, but the value is the same for all usages.
So, to return (echoing) more than one value from base would be difficult from the file reading the returns or I just don't know how to do it.
So, let me know what is your idea and let's make that happen :)
There was a problem hiding this comment.
Should I echo the value instead assigned into a variable, then?
There was a problem hiding this comment.
Still did not have time to review this one yet 😬
Once I review I will answer you!
What is the goal of this PR? | Qual é o objetivo deste PR?
Solve this issue
Issue with new Docker compose commandCreate a script that can decide which "docker compose" binary should be used.
The priority still on the
docker-composebinary. Ifdocker-composedoesn't exist, then, usedocker composebase.shcan be used for other things later, like define "default" values and load from the base.What has been done to achieve the goal? | O que foi feito para alcançar o objetivo?
Check if
docker-composebinary exists. If yes, use it, if not, fallback todocker composeHow to test if the changes work? | Como testar se as alterações funcionam?
run.shand add another line like:echo $DOCKER_COMPOSEafter line 6docker/run.shdocker-compose, the output from the line above will be the path of yourdocker-composedocker-compose, the output from the line above will bedocker composedocker-composechanging the content ofDOCKER_COMPOSE_BINonbase.shline 3 and rundocker/run.shagain