-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathapp
executable file
·72 lines (62 loc) · 1.32 KB
/
app
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
#!/bin/bash
# This script simplifies running the docker compose configured services.
set -e
help() {
echo "Commands for building, testing, and running a local typekit stack."
echo
echo "Commands:"
echo "clean Destroy all existing dependencies and compiled assets."
echo "build Build and install all dependencies from scratch."
echo "run Start the application stack."
echo "stop Stop the application stack."
echo "console Start an interactive console."
echo
}
clean() {
docker image rm \
cppcon/wasm
}
build() {
VERSION=latest
docker build \
--platform linux/amd64 \
-t cppcon/wasm:$VERSION .
mkdir output
}
run() {
container=$(docker run \
--rm -v $(pwd)/:/build/ \
--platform linux/amd64 \
-p 8000:8000 \
--entrypoint entrypoint.sh \
cppcon/wasm)
}
console() {
docker run \
--rm -it --platform linux/amd64 \
-p 8000:8000 \
-v $(pwd)/:/build/ \
--entrypoint /bin/bash \
cppcon/wasm
}
stop() {
docker stop \
$(docker container ls | grep 'cppcon/wasm' | awk '{print $1}' | xargs)
}
main() {
if [ "$1" = clean ]; then
clean
elif [ "$1" = build ]; then
build
elif [ "$1" = run ]; then
shift
run "$@"
elif [ "$1" = console ]; then
console
elif [ "$1" = stop ]; then
stop
else
help
fi
}
(main "${@}")