1

I'm trying to run my GitHub Page which is using Jekyll locally on my Windows machine (code of my page).

The Jekyll config _config.yml references the following plugins:

# all the other Jekyll settings

plugins:
  - jekyll-seo-tag
  - jekyll-sitemap
  - jemoji

I follow the official manual from here and created the following docker-compose.yml:

version: '2.2'

services:
  jekyll:
    image: jekyll/jekyll:3.8
    command: >
      sh -c "gem install jekyll-seo-tag jekyll-sitemap jemoji &&
             jekyll build &&
             jekyll serve --watch --force_polling --verbose"
    ports:
      - 4000:4000
    volumes:
      - .:/srv/jekyll

As you can see, at first I have to manually install all dependencies (which are specified in the plugins section of _config.yml).

When reducing the command to jekyll serve (as described in the docs), the following error occurs:

mu88githubio-jekyll-1  | ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux-musl]
mu88githubio-jekyll-1  | Configuration file: /srv/jekyll/_config.yml
mu88githubio-jekyll-1  |   Dependency Error: Yikes! It looks like you don't have jekyll-seo-tag or one of its dependencies installed. In order to use Jekyll as currently configured, you'll need to install this gem. The full error message from Ruby is: 'cannot load such file -- jekyll-seo-tag' If you run into trouble, you can find helpful resources at https://jekyllrb.com/help/!
mu88githubio-jekyll-1  | jekyll 3.8.6 | Error:  jekyll-seo-tag
mu88githubio-jekyll-1 exited with code 1

The docs also mention the command bundle update, but this gives me:

mu88githubio-jekyll-1  | Could not locate Gemfile
mu88githubio-jekyll-1 exited with code 10

What bothers me with my current "solution" is that I have to specify the dependencies/plugins twice, both in docker-compose.yml and _config.yml.

Is it possible to get rid of this redundancy and make the Jekyll Docker image restore the necessary gems automatically when using jekyll serve and using _config.yml?

Thanks and have a great weekend!

mu88
  • 4,156
  • 1
  • 23
  • 47

0 Answers0