-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathops.sh
executable file
·54 lines (44 loc) · 1.06 KB
/
ops.sh
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
#!/usr/bin/env bash
# Heavily borrowed from Cris Fidao and the "Shipping Docker" course
# https://serversforhackers.com/shipping-docker
COMPOSE="docker compose"
# If we pass any arguments...
if [ $# -gt 0 ];then
# Run the artisan console
if [ "$1" == "art" ]; then
shift 1
$COMPOSE exec \
php \
php artisan "$@"
# Run the artisan console
elif [ "$1" == "artisan" ]; then
shift 1
$COMPOSE exec \
php \
php artisan "$@"
# Run Composer
elif [ "$1" == "composer" ]; then
shift 1
$COMPOSE exec \
php \
composer "$@"
# Run Yarn
elif [ "$1" == "yarn" ]; then
shift 1
$COMPOSE run --rm \
node \
yarn "$@"
# Connect to the Postgres CLI
elif [ "$1" == "psql" ]; then
shift 1
$COMPOSE exec \
--user=postgres \
postgres \
psql "$@"
# Else, pass through to docker compose
else
$COMPOSE "$@"
fi
else
$COMPOSE ps
fi