diff --git a/README.md b/README.md index ec08fee..5930698 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ Counting on my modest shell scripting skills, I managed to give life to an abomi - Build the image via the provided `docker-compose.yml` file. - Run the service. +Jekyll is started by default in "production mode", a.k.a. it will just build static files. If you want your files to be served by jekyll for testing needs, just change `JEKYLL_ENV` to anything other that `production`. Variables in .env and the site description are updated at container restart. **Keep in mind that changing your site name (with `BLOG_NAME` var) will fudge up all reference files (site description, site path etc.).** diff --git a/data/.env.example b/data/.env.example index 6c1d196..a81850a 100644 --- a/data/.env.example +++ b/data/.env.example @@ -1,5 +1,6 @@ AUTHOR_EMAIL= BLOG_NAME= +JEKYLL_ENV= LIVERELOAD_PORT= GITHUB_USERNAME= HOST_URL= diff --git a/data/entrypoint.sh b/data/entrypoint.sh index 140eaa6..ff91da0 100755 --- a/data/entrypoint.sh +++ b/data/entrypoint.sh @@ -6,13 +6,14 @@ export BASE_URL=$BASE_URL export GEM_HOME="/usr/local/bundle" export GITHUB_USERNAME=$GITHUB_USERNAME export HOST_URL=$HOST_URL +export JEKYLL_ENV=${JEKYLL_ENV:-production} export LIVERELOAD_PORT=$LIVERELOAD_PORT export PATH="$GEM_HOME/bin:$GEM_HOME/gems/bin:$PATH" export SITE_PATH="/app/jekyll/$BLOG_NAME" export SITE_TITLE=$SITE_TITLE export THEME=$THEME export TWITTER_USERNAME=$TWITTER_USERNAME -export WWW_PORT=$WWW_PORT +export WWW_PORT=${WWW_PORT:-4000} export URL=$URL update_config() { @@ -66,12 +67,22 @@ cd /app/jekyll && bundle install update_config update_description - bundle exec jekyll serve --host $HOST_URL + [[ "$JEKYLL_ENV" == "production" ]] && + { + bundle exec jekyll build --trace + } || { + bundle exec jekyll serve --host $HOST_URL + } } || { jekyll new $SITE_PATH cd $SITE_PATH bundle install update_config update_description - bundle exec jekyll serve --host $HOST_URL + [[ "$JEKYLL_ENV" == "production" ]] && + { + bundle exec jekyll build --trace + } || { + bundle exec jekyll serve --host $HOST_URL + } }