-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
launchchess
executable file
·46 lines (38 loc) · 1.51 KB
/
launchchess
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
#!/bin/bash
VERSION=0.1.0
if [ $1 = "version" -o $1 = "v" -o $1 = "-v" ]; then
echo $VERSION
elif [ $1 = "init" ]; then
# install pip and npm requirements
shift
pip install -r requirements.txt
docker run -it -v $(pwd)/web:/app -w /app node yarn install "$@"
elif [ $1 = "install" -o $1 = "i" ]; then
# add a new package
shift
docker run -it -v $(pwd)/web:/app -w /app node yarn add "$@"
elif [ $1 = "build" ]; then
# build js files, no dev server
shift
docker run -it -v $(pwd)/web:/app -w /app -p 5555:5555 node yarn parcel watch --port 5555 --no-cache --dist-dir dist src/index.html
elif [ $1 = "dev" ]; then
# start dev server (no https)
shift
docker run -it -v $(pwd)/web:/app -w /app -p 5555:5555 node yarn parcel --port 5555 --no-cache --dist-dir dist src/index.html
elif [[ $1 = "run" || $1 =~ "serve" ]]; then
# run local https server
shift
# uvicorn --reload --host 0.0.0.0 --port 5000 api:app
uvicorn api:app --port 9999 --ssl-keyfile=./testcert-key.pem --ssl-certfile=./testcert.pem --reload
elif [[ $1 = "prod" || $1 = "production" || $1 = "p" ]]; then
# run production image
shift
docker-compose down
docker run -it -v $(pwd)/web:/app -w /app node yarn parcel build --no-cache --dist-dir dist src/index.html
docker-compose up -d --build "$@"
elif [[ $1 = "cert" ]]; then
# generate a new self-signed certificate
shift
openssl req -x509 -newkey rsa:4096 -nodes -keyout testcert-key.pem -out testcert.pem -sha256 -days 365 && \
echo "Successfully generated certfiles!"
fi