-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add script that allows executing a command with the docker compose env (
#822) The script encapsulates starting and stopping the docker environment and executes the supplied command while the environment is up.
- Loading branch information
1 parent
26d379e
commit 463e2d3
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |