-
Notifications
You must be signed in to change notification settings - Fork 1
/
xfile
executable file
·31 lines (24 loc) · 798 Bytes
/
xfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env bash
set -euo pipefail
DOCKER=${DOCKER:-"docker"}
COMPOSE_FILE="./xtask/devenv/compose.yml"
if [ $($DOCKER compose --file "$COMPOSE_FILE" ps -q | wc -l) -gt 0 ]; then
echo "Development environment is already running."
else
echo "Starting development environment."
$DOCKER compose --file "$COMPOSE_FILE" up --build -d
fi
if [ "${1:-}" = "devenv" ]; then
shift
exec $DOCKER compose \
--file ./xtask/devenv/compose.yml \
"$@"
fi
if [ "${1:-}" = "shell" ]; then
exec $DOCKER compose \
--file ./xtask/devenv/compose.yml \
exec --privileged devenv "/project/xtask/devenv/run.sh" zsh
fi
exec $DOCKER compose \
--file ./xtask/devenv/compose.yml \
exec --privileged devenv "/project/xtask/devenv/run.sh" cargo xtask "$@"