Something has always bothered me about deploying something that I haven't tested locally. A big manifestation of this is my blog. Since my blog is currently hosted on GitHub Pages, I needed Jekyll and all of its dependencies. Since those aren't things I typically have installed, so I decided to use a piece of software I always install: Docker.
The whole ordeal managed to come out to a single line:
docker run --rm -it -v $(pwd):/srv/jekyll -p 4000:4000 jekyll/jekyll jekyll serve --watch
docker run --rm -it -v "%cd%":/srv/jekyll -p 4000:4000 jekyll/jekyll jekyll serve --watch
Note the double quotes since Windows paths can have spaces
This command should be run in the root of your GitHub Pages project. It will create a Jekyll container that is listening to the current directory for changes and is exposed via port
4000. This way as you edit either blog content or site styling the changes appear as quickly as the site refreshes in your browser.
Top comments (0)