aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Dockerfile6
-rw-r--r--docker/entrypoint.sh14
2 files changed, 10 insertions, 10 deletions
diff --git a/Dockerfile b/Dockerfile
index 7f64956..f36d060 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -6,14 +6,12 @@ WORKDIR /cstate
# Install hugo & git
RUN apk add --no-cache hugo git
-# -- First Run --
-
# Download the example site
-RUN git clone https://github.com/cstate/example /cstate
+RUN git clone -b master --depth=1 https://github.com/cstate/example /cstate
# Copy files from this repo into themes/cstate
RUN mkdir -p /cstate/themes/cstate
COPY . /cstate/themes/cstate
-# Prepare the entrypoint files
+# Copy entrypoint script into the container image, this runs everytime the container cold-starts.
COPY ./docker/entrypoint.sh /docker-entrypoint.d/10-build-hugo.sh
diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh
index f8068c1..a90e37d 100644
--- a/docker/entrypoint.sh
+++ b/docker/entrypoint.sh
@@ -1,21 +1,23 @@
WORK_DIR="/app"
SRC_DIR="/cstate"
+echo "[CSTATE-DOCKER] Initalising 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 "First time run! Hello, World :)"
+ echo "[CSTATE-DOCKER] Copying cState into staging area. First Start."
cp -R $SRC_DIR/* $WORK_DIR
fi
-# Continue with building
-
-# CD into working dir
-cd /app
+cd $WORK_DIR
# Build the hugo site
+echo "[CSTATE-DOCKER] Running hugo build service..."
hugo
# Copy built files into NGINX directory
-cp -r /app/public/* /usr/share/nginx/html \ No newline at end of file
+cp -r /$WORK_DIR/public/* /usr/share/nginx/html
+
+echo "[CSTATE-DOCKER] Initalisation complete." \ No newline at end of file