-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentry.sh
More file actions
42 lines (34 loc) · 711 Bytes
/
entry.sh
File metadata and controls
42 lines (34 loc) · 711 Bytes
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
#!/bin/sh
set -e
export GATSBY_DIR="/site"
export PATH="$PATH:/usr/local/bin/gatsby"
# Initialize Gatsby or run NPM install if needed
if [ ! -f "$GATSBY_DIR/package.json" ]
then
echo "Initializing Gatsby..."
gatsby new $GATSBY_DIR
else
if [ ! -e "$GATSBY_DIR/node_modules/" ]
then
echo "Node modules is empty. Running npm install..."
npm install
npm rebuild node-sass
fi
fi
# Decide what to do
if [ "$1" == "develop" ]
then
rm -rf $GATSBY_DIR/public
gatsby develop --host 0.0.0.0
elif [ "$1" == "build" ]
then
rm -rf $GATSBY_DIR/public
gatsby build
elif [ "$1" == "stage" ]
then
rm -rf $GATSBY_DIR/public
gatsby build
gatsby serve --port 8000
else
exec $@
fi