aboutsummaryrefslogtreecommitdiff
path: root/docker/entrypoint.sh
blob: 9ac6c2cf2683076f18f14e2fca8c517207f07000 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
WORK_DIR="/app"
SRC_DIR="/cstate"

echo "[CSTATE-DOCKER] Initialising container..."

# Check if the working dir is empty, if it is we'll need to copy
# the files in from src directory (usually /cstate)
if ! [ "$(ls -A $WORK_DIR)" ]; then
    # First run, copy cstate's files in.
    echo "[CSTATE-DOCKER] Copying cState into staging area. First Start."
    cp -R $SRC_DIR/* $WORK_DIR
fi

cd $WORK_DIR

# Build the hugo site
echo "[CSTATE-DOCKER] Running hugo build service..."
hugo

# Copy built files into NGINX directory
cp -r /$WORK_DIR/public/* /usr/share/nginx/html

echo "[CSTATE-DOCKER] Initialisation complete."