From f712efb4569eeac5a39fa09dfa84c7c3db7d2d51 Mon Sep 17 00:00:00 2001 From: rzen Date: Wed, 9 Sep 2020 23:10:14 -0400 Subject: [PATCH] more docs --- README.md | 2 +- _blog/jekyll-with-docker.md | 113 ++++++++++++++++++++++++++++++++++++ 2 files changed, 114 insertions(+), 1 deletion(-) create mode 100644 _blog/jekyll-with-docker.md diff --git a/README.md b/README.md index 1988111..183763d 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ Add this line to site's `Gemfile`: ```ruby gem "jekyll-theme-isabelline", "~> 0.1.0" ``` -And add this line to your Jekyll site: +And add this line to your Jekyll site `_config.yaml`: ```yaml theme: jekyll-theme-isabelline diff --git a/_blog/jekyll-with-docker.md b/_blog/jekyll-with-docker.md new file mode 100644 index 0000000..afffa40 --- /dev/null +++ b/_blog/jekyll-with-docker.md @@ -0,0 +1,113 @@ +--- +title: Using Jekyll with docker +layout: page +date: 2020-09-07 +tags: docker docker-compose jekyll +--- + +# {{ page.title }} + +If you have docker desktop installed and you dont wish to install ruby/jekyll, you can use docker to create and author your jekyll-based site. + +## Getting started + +To create a new website, create a new directory: + +```sh +mkdir new-jekyll-site && cd new-jekyll-site +``` + +Run `jekyll new` in a container: + +```sh +docker run --rm -it -v (PWD):/srv/jekyll jekyll/jekyll:4 jekyll new . +``` + +## Configuring isabelline theme + +Add the following line to `Gemfile`: + +```ruby +gem "jekyll-theme-isabelline", "~> 0.1.0" +``` + +And add this line to your Jekyll site `_config.yaml`: + +```yaml +theme: jekyll-theme-isabelline +``` + +Chances are if you're creating a site from scratch, `Gemfile` and `_config.yaml` will be referencing the theme "minima". Replace with desired theme (in this example `jekyll-theme-isabelline`). + +Run `bundle`: + +```sh +docker run --rm -it \ + -v (PWD):/srv/jekyll \ + -v (PWD)/.bundle:/usr/local/bundle \ + -v (PWD)/.gem:/root/.gem \ + jekyll/jekyll:4 bundle +``` + +At this point you're ready to run jekyll serve in local mode: + +```sh +docker run --rm -it -p 4000:4000 \ + -v (PWD):/srv/jekyll \ + -v (PWD)/.bundle:/usr/local/bundle \ + -v (PWD)/.gem:/root/.gem \ + jekyll/jekyll:4 \ + jekyll serve --host 0.0.0.0 --future --draft --force_polling --livereload +``` + +## Download customized `.gitignore`, `index.html`, `_config.yaml` and `docker-compose.yaml` + +Optionally backup your current files: + +```sh +mv _config.yml _config.yml.backup +mv _config.yaml _config.yaml.backup +mv index.html index.html.backup +mv .gitignore .gitignore.backup +``` + +Download the files: + +```sh +curl -o _config.yaml https://git.rzen.dev/rzen/jekyll-theme-isabelline/raw/branch/master/_config.yaml +curl -o docker-compose.yaml https://git.rzen.dev/rzen/jekyll-theme-isabelline/raw/branch/master/docker-compose.yaml +curl -o index.html https://git.rzen.dev/rzen/jekyll-theme-isabelline/raw/branch/master/index.html +curl -o private.html https://git.rzen.dev/rzen/jekyll-theme-isabelline/raw/branch/master/private.html +curl -o .gitignore https://git.rzen.dev/rzen/jekyll-theme-isabelline/raw/branch/master/.gitignore +``` + +The `_config.yaml` references several gems that do not come pre-configured on `jekyll new`, make sure the following gems are declared in `Gemfile`: + +```ruby +group :jekyll_plugins do + gem 'jekyll-tidy' + gem 'jekyll-tagging' + gem 'jekyll-mentions' + gem 'jekyll-sitemap' + gem 'jekyll-feed' + gem 'jekyll-seo-tag' +end +``` + +## Create directories for posts, blogs and private notes + +```sh +mkdir _blog _pages _posts _drafts _private +``` + +## Docker compose + +For your convenience a docker-compose.yaml file is included. Run `jekyll serve` as follows: + +```sh +docker-compose up serve +``` + +Additionally it can be used to run `jekyll`, `bundle` or `gem`. The service `gem-push` can be used to publish gems to [rubygems.org](https://rubygems.org). + + \ No newline at end of file