feat: add production mode
This commit is contained in:
parent
ceafb9184f
commit
64990a8853
@ -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.).**
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
AUTHOR_EMAIL=
|
||||
BLOG_NAME=
|
||||
JEKYLL_ENV=
|
||||
LIVERELOAD_PORT=
|
||||
GITHUB_USERNAME=
|
||||
HOST_URL=
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user