Skip to content

Commit

Permalink
Update container
Browse files Browse the repository at this point in the history
  • Loading branch information
fletchto99 authored Nov 22, 2022
1 parent f1760b9 commit 55b38b2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 23 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ COPY setup /setup
RUN (cd /setup; sh bootstrap.sh)

# Set the work directory to blog
WORKDIR /blog
WORKDIR /config

# Start the server
CMD ["/bin/bash", "/blog/run.sh"]
CMD ["/bin/bash", "/setup/run.sh"]
21 changes: 0 additions & 21 deletions setup/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,3 @@ apt-get -y install rsync

# Install HEXO
npm install -g hexo

# Check to ensure the /config volume is mounted
if [ ! -d "/config" ]; then
echo "Please mount a /config directory so you blog persists upon container restarts!"
echo "If this is your first time setting up the container make sure the /config directory is empty!"
exit 1
fi

echo "Linking configs to blog runtime dir..."
ln -s /config /blog

if [ -z "$(ls -A /config)" ]; then
echo "Blog not yet initialized, setting up the default files..."
# Initilize the blog
hexo init /blog
else
echo "Blog already initialized, skipping..."
fi

# Copy bootstrap scrpt
cp /setup/run.sh /blog/run.sh
16 changes: 16 additions & 0 deletions setup/run.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
#!/bin/bash

# Check to ensure the /config volume is mounted
if [ ! -d "/config" ]; then
echo "Please mount a /config directory so you blog persists upon container restarts!"
echo "If this is your first time setting up the container make sure the /config directory is empty!"
exit 1
fi

if [ -z "$(ls -A /config)" ]; then
echo "Blog not yet initialized, setting up the default files..."
# Initilize the blog
hexo init /config
else
echo "Blog already initialized, skipping..."
fi

# Install any required hexo plugins
if [[ -z "${HEXO_PLUGINS}" ]]; then
echo "No additional plugins to install!"
Expand All @@ -12,5 +27,6 @@ fi
echo "Starting hexo server on port 8080"

# Start fresh
cd /config || exit 1
hexo clean || true
hexo server -p 8080 --debug --draft

0 comments on commit 55b38b2

Please sign in to comment.