duong on Nostr: Ok, let's say I wanna test this script, without installing docker-compose: $ cat ...
Ok, let's say I wanna test this script, without installing docker-compose:
$ cat manage.sh
#!/bin/sh
RUNNING_IDS=$(docker-compose ps -q)
if [ -z "$RUNNING_IDS" ]; then
echo "docker-compose is not running."
exit 1
fi
docker-compose exec -e LOG_LEVEL=${LOG_LEVEL:-INFO} backend python3 manage.py "$@"
I can use the PATH trick:
$ printf '#!/bin/sh' > docker-compose && chmod +x docker-compose && PATH=.:$PATH ./manage.sh
docker-compose is not running.
Here I create a docker-compose file (that is just an empty shell script), and called the script that I wanted to test with the current directory added to the PATH.
$ cat manage.sh
#!/bin/sh
RUNNING_IDS=$(docker-compose ps -q)
if [ -z "$RUNNING_IDS" ]; then
echo "docker-compose is not running."
exit 1
fi
docker-compose exec -e LOG_LEVEL=${LOG_LEVEL:-INFO} backend python3 manage.py "$@"
I can use the PATH trick:
$ printf '#!/bin/sh' > docker-compose && chmod +x docker-compose && PATH=.:$PATH ./manage.sh
docker-compose is not running.
Here I create a docker-compose file (that is just an empty shell script), and called the script that I wanted to test with the current directory added to the PATH.