- A running Docker installation.
We'll be using the github-pages
gem and the Jekyll Docker image.
The last version of the pages-gem
(204) uses Jekyll 3.8.5, so we'll start with that Docker image as a base.
- Create an empty folder on your disk, where you'll host your blog. We'll push it to GitHub later.
- Within that folder, run:
docker run --rm --volume="$PWD:/srv/jekyll" --volume="$PWD/vendor/bundle:/usr/local/bundle" -it jekyll/jekyll:3.8.5 jekyll new . --force
This will pull the Jekyll image, and runjekyll new
to create a new Jekyll site. We are mounting the local foldervendor/bundle
so we can cache the gem and they are not downloaded everytime we run a Jekyll command. - Edit the
Gemfile
and comment the line that readsgem "jekyll", "~> 3.8.5"
, and uncomment the line that saysgem "github-pages", group: :jekyll_plugins
.- Exit
vi
(out of scope for this tutorial)
- Exit
- Run
bundle update
within the Docker container by doing:docker run --rm --volume="$PWD:/srv/jekyll" --volume="$PWD/vendor/bundle:/usr/local/bundle" -it jekyll/jekyll:3.8.5 bundle update
- Check that your newly created blog is working by running:
docker run --rm --publish 4000:4000 --volume="$PWD:/srv/jekyll" --volume="$PWD/vendor/bundle:/usr/local/bundle" -it jekyll/jekyll:3.8.5 jekyll serve
and opening http://localhost:4000
If the site works, you are ready to push it to you GitHub pages repository.
- Create your GitHub personal pages repository. The name of the repository is based on your username. The repo should be named
username.github.io
. - On the blog folder, run the usual
git
commands to make a repo and push it:git init
git add *
(there will be a.gitignore
created for you that excludes the generated pages. Keep it).git add .gitignore
git commit -m "Initial commit"
- Add the origin repository
git remote add origin git@github.com:username/username.github.io.git
- Push
git push -u origin master
- Check you new blog at
https://username.github.io