-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexecute
More file actions
executable file
·79 lines (64 loc) · 1.82 KB
/
execute
File metadata and controls
executable file
·79 lines (64 loc) · 1.82 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/usr/bin/env bash
WHITE='\033[1;37m'
NC='\033[0m'
# Ensure that Docker is running...
if ! docker info > /dev/null 2>&1; then
echo -e "${WHITE}Docker is not running.${NC}" >&2
exit 1
fi
if [ $# -gt 0 ]; then
# Source the ".env" file so environment variables are available...
if [ -f ./.env ]; then
source ./.env
fi
# Initiate Storybook within the application container...
if [ "$1" == "storybook" ]; then
shift 1
docker run --rm -it \
-w /app \
-p 6006:6006 \
-v $(pwd):/app \
node:latest \
npm run storybook
# Proxy NPM commands to the "npm" binary on the application container...
elif [ "$1" == "npm" ]; then
shift 1
docker run --rm -it \
-w /app \
--env-file ./.env \
-v $(pwd):/app \
node:latest \
npm "$@"
# Publish the package to NPM...
elif [ "$1" == "release" ]; then
shift 1
docker run --rm -it \
-w /app \
--env-file ./.env \
-v $(pwd):/app \
-v ~/.gitconfig:/etc/gitconfig \
node:latest \
npm run release && git push
# Proxy NPX commands to the "npx" binary on the application container...
elif [ "$1" == "npx" ]; then
shift 1
docker run --rm -it \
-w /app \
-v $(pwd):/app \
node:latest \
npx "$@"
# Proxy YARN commands to the "yarn" binary on the application container...
elif [ "$1" == "yarn" ]; then
shift 1
docker run --rm -it \
-w /app \
-v $(pwd):/app \
node:latest \
yarn "$@"
# Pass unknown commands to the "docker" binary...
else
docker "$@"
fi
else
docker ps
fi