-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrun
More file actions
executable file
·56 lines (51 loc) · 1.29 KB
/
run
File metadata and controls
executable file
·56 lines (51 loc) · 1.29 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/env bash
opt="$1"
docker=$(command -v docker >/dev/null 2>&1)
shift
case "$opt" in
--help)
echo "Helper to run project commands locally if possible, and if not to run them in the compose.dev.yaml 'php' container"
echo ""
echo "Options:"
echo " --help Show this help"
echo " --build Build the 'php' container from compose.dev.yaml"
echo " --container Run the command in the 'php' container even if it exists locally"
exit 0
;;
--build)
./build
;;
--local)
run="$1"
shift
"$run" "$@"
;;
--container)
if ! $docker
then
echo "Docker not installed!"
exit 1
fi
run="$1"
shift
docker compose --file compose.dev.yaml run --remove-orphans php "$run" "$@"
;;
--*)
echo "Unknown option '$opt'"
exit 1
;;
*)
run="$opt"
if command -v "$run" >/dev/null 2>&1
then
"$run" "$@"
else
if ! $docker
then
echo "Docker not installed!"
exit 1
fi
docker compose --file compose.dev.yaml run --remove-orphans php "$run" "$@"
fi
;;
esac