• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

BretFisher/jekyll-serve: Jekyll in a Docker Container For Easy SSG Development

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

BretFisher/jekyll-serve

开源软件地址:

https://github.com/BretFisher/jekyll-serve

开源编程语言:

Dockerfile 73.0%

开源软件介绍:

Jekyll in a Docker Container

GitHub Super-Linter Docker Build

But this has been done. Why not docker run jekyll/jekyll?

  • I wanted two images, one for easy CLI (bretfisher/jekyll) and one for easy local server for dev with sane defaults (bretfisher/jekyll-serve), which I use 90% of time
  • So you can start any Jekyll server with docker-compose up
  • I wanted to dev on a local jekyll site w/o having jekyll installed on my host OS
  • I wanted it to be as easy as possible to start
  • I wanted current debian/alpine, ruby, and jekyll (these images update monthly to latest versions)

So, this does that.

Note I have courses on Docker (including a Lecture on Jekyll in Docker).

‼️ ‼️ ‼️

⚠️ WARNING: ⚠️ This isn't meant to be a production image that you run a web server with. I don't do that with the Jekyll CLI that comes with this image. Jekyll CLI generates a static site that you can run with GitHub Pages, Netlify, or your own NGINX setup. Furthermore, I don't version anything so these images will not run guaranteed versions of Ruby, Jekyll, etc. (which, if you're running a server, should pin all versions usually.)

Docker Images

Image Purpose Example
bretfisher/jekyll Runs Jekyll by default with no options, good for general CLI commands docker run -v $(pwd):/site bretfisher/jekyll new .
bretfisher/jekyll-serve Runs Jekyll serve with sane defaults, good for local Jekyll site dev docker run -p 4000:4000 -v $(pwd):/site bretfisher/jekyll-serve
:alpine tag Runs an Alpine variant of the above images

Getting Started

Creating a site:

cd to empty directory
docker run -v $(pwd):/site bretfisher/jekyll new .

Start a local server with sane defaults listening on port 4000:

cd dir/of/your/jekyll/site
docker run -p 4000:4000 -v $(pwd):/site bretfisher/jekyll-serve

That's it!

Details: it will mount your current path into the containers /site, bundle install before running jekyll serve to , serve it at http://<docker-host>:4000.

To make this even easier, copy docker-compose.yml from this repository to your jekyll site root. Then you'll only need to:

cd dir/of/your/jekyll/site
docker-compose up

Known issues

  1. webrick errors during startup.

    • As of April 2021, Ruby 3.0 is out, and Jekyll is still on 4.2 (released 12/2020). Jekyll 4.2 doesn't have webrick listed as a dependency, so we'll have to manually add it to Gemfile for now if you want to use Ruby 3.0. Ruby 3.0 removed this bundled gems so you'll need to add them manually if you use them: sdbm, webrick, net-telnet, xmlrpc. Hopefully Jekyll 4.3 will have webrick listed as a Jekyll dependency (it is fixed in Jekyll master branch) so manually updating Gemfiles won't be needed.
    • Note this image was reverted back to Ruby 2.x in June 2021 to prevent the issues found in 3.0

Q&A

Q. What if I want to run other jekyll commands?

just add the jekyll options to the end of the bretfisher/jekyll:

docker run -v $(pwd):/site bretfisher/jekyll doctor

License

MIT License

Copyright (c) [Bret Fisher [email protected]]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
jekyll/minima: Minima is a one-size-fits-all Jekyll theme for writers.发布时间:2022-07-07
下一篇:
bitbrain/jekyll-dash: 发布时间:2022-07-07
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap