Skip to content

Commit

Permalink
Add script that allows executing a command with the docker compose env (
Browse files Browse the repository at this point in the history
#822)

The script encapsulates starting and stopping the docker environment and executes the supplied command while the environment is up.
  • Loading branch information
frederikrothenberger committed Aug 22, 2022
1 parent 26d379e commit 463e2d3
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions scripts/with-docker-env
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/usr/bin/env bash
set -euo pipefail

# Make sure we always run from the root
SCRIPTS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$SCRIPTS_DIR/.."

#########
# USAGE #
#########

function title() {
echo "Execute a command between starting and stopping the docker compose environment"
}

function usage() {
cat << EOF
Usage:
$0 <subcommand>
EOF
}

function help() {
cat << EOF
Starts the docker compose environment, executes the subcommand and stops docker compose again.
NOTE: This requires docker, docker-compose, a running dfx replica with II and the test app deployed and running II dev server (npm run start).
EOF
}

scripts/start-selenium-env

ret=0
"$@" || ret="$?"

echo "'$*' returned with $ret"

cd docker-test-env
docker compose down || echo "docker compose failed to shut down!"
exit "$ret"

0 comments on commit 463e2d3

Please sign in to comment.