Test Jekyll Generated GitHub Pages Locally Using Docker
Github Pages & Jekyll
You can create a website directly from a GitHub repository. GitHub Pages have a built in support for a static site generator, Jekyll.
Test Locally with Docker
Testing generated pages locally before deploying to GitHub is possible, but installation of Jekyll is not extremely simple.
- Install Ruby
- Install RubyGems
- Install GCC and Make
- Install Jekyll
- Confgure …
Easier way is to use Docker image with a correct configuration: starefossen/github-pages
Start image by going to your github.io-directory with Jekyll generated site and mount your directory in a volume under /usr/src/app.
# Linux / macOS
$ docker run --rm -v "$PWD":/usr/src/app -p 4000:4000 starefossen/github-pages
# Windows
$ docker run --rm -v %cd%:/usr/src/app -p 4000:4000 starefossen/github-pages
Go to http://localhost:4000 and see your page. All changes you make to the files are refreshed automatically.
Written on June 20, 2021