-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfwd
67 lines (56 loc) · 1.25 KB
/
fwd
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
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/env bash
export ASUSER=${ASUSER:-$UID}
export COMPOSE_EXEC_FLAGS=${COMPOSE_EXEC_FLAGS:-""}
# Is the environment running
PSRESULT="$(docker-compose ps -q)"
if [ ! -z "$PSRESULT" ]; then
IS_RUNNING="yes"
else
IS_RUNNING="no"
fi
# Create base docker-compose command to run
COMPOSE="docker-compose"
COMPOSE_EXEC="$COMPOSE exec $COMPOSE_EXEC_FLAGS"
if [ $# -eq 0 ]; then
$COMPOSE ps
exit 0
fi
# Start up containers
elif [ "$1" == "start" ]; then
$COMPOSE up -d
# Stop the containers
elif [ "$1" == "stop" ]; then
$COMPOSE down
# If "node" is used, run node
# from our node container
elif [ "$1" == "node" ]; then
shift 1
$COMPOSE run --rm \
node \
node "$@"
# If "npm" is used, run npm
# from our node container
elif [ "$1" == "npm" ]; then
shift 1
$COMPOSE run --rm \
node \
npm "$@"
# If "yarn" is used, run yarn
# from our node container
elif [ "$1" == "yarn" ]; then
shift 1
$COMPOSE run --rm \
node \
yarn "$@"
# If "hot" is used, run yarn hot
# from our node container
elif [ "$1" == "hot" ]; then
shift 1
$COMPOSE run --rm \
-p 8080:8080 \
node \
yarn hot
# Else, pass-thru args to docker-compose
else
$COMPOSE "$@"
fi