First, clone from the following URL to Ubuntu VM:
https://github.com/potikanond/docker-jekyll-sample5.git
On Ubuntu VM run the following command:
$ git clone https://github.com/potikanond/docker-jekyll-sample5.git
This will clone the application from GitHub to docker-jekyll-sample5 directory.
Reference: https://jekyllrb.com/
Check out the image description and Dockerfile
https://hub.docker.com/r/bretfisher/jekyll-serve/
Dockerfile:
FROM ruby:2.4-alpine RUN apk add --no-cache build-base gcc bash cmake RUN gem install jekyll EXPOSE 4000 WORKDIR /site # create new site by setting -e JEKYLL_NEW=true ENV JEKYLL_NEW false COPY docker-entrypoint.sh /usr/local/bin/ # on every container start we'l' ENTRYPOINT [ "docker-entrypoint.sh" ] CMD [ "bundle", "exec", "jekyll", "serve", "--force_polling", "-H", "0.0.0.0", "-P", "4000" ]
Inside the Jekyll app directory, check out the _posts directory.
We will modify the post in this diretory.
$ docker container run -p 8080:4000 -v $(pwd):/site bretfisher/jekyll-serve
Wiht this command, the docker-jekyll-sample5 directory on the host is mounted to /site in the container.
sample output:
Fetching gem metadata from https://rubygems.org/...........
Using public_suffix 3.0.3
Using addressable 2.5.2
Using bundler 1.16.4
Using colorator 1.1.0
Using concurrent-ruby 1.0.5
Using eventmachine 1.2.7
Using http_parser.rb 0.6.0
Using em-websocket 0.5.1
Using ffi 1.9.25
Using forwardable-extended 2.6.0
Using i18n 0.9.5
Using rb-fsevent 0.10.3
Using rb-inotify 0.9.10
Using sass-listen 4.0.0
Using sass 3.5.7
Using jekyll-sass-converter 1.5.2
Using ruby_dep 1.5.0
Using listen 3.1.5
Using jekyll-watch 2.0.0
Using kramdown 1.17.0
Using liquid 4.0.0
Using mercenary 0.3.6
Using pathutil 0.16.1
Using rouge 3.2.1
Using safe_yaml 1.0.4
Fetching jekyll 3.7.3
Installing jekyll 3.7.3
Fetching jekyll-feed 0.10.0
Installing jekyll-feed 0.10.0
Fetching jekyll-seo-tag 2.5.0
Installing jekyll-seo-tag 2.5.0
Fetching minima 2.5.0
Installing minima 2.5.0
Bundle complete! 4 Gemfile dependencies, 29 gems now installed.
Bundled gems are installed into `/usr/local/bundle`
Configuration file: /site/_config.yml
Deprecation: The 'gems' configuration option has been renamed to 'plugins'. Please update your config file accordingly.
Source: /site
Destination: /site/_site
Incremental build: disabled. Enable with --incremental
Generating...
done in 0.879 seconds.
Auto-regeneration: enabled for '/site'
Server address: http://0.0.0.0:4000/
Server running... press ctrl-c to stop.
Now, we can access Jekyll app from the URL http://localhost:8080.
We can update the site on the host by editing *.markdown file in the docker-jekyll-sample5/_posts directory.
For example, we can edit the title in a markdown file to "Welcome to Jekyll! - CPE405".
2017-03-05-welcome-to-jekyll.markdown:
... title: "Welcome to Jekyll! - CPE405 is Fun" ...
This will change the files in the /site/_posts directory inside the container as well.
After saving the file, Jekyll will autogenerate the updated version of the site.