Skip to content

Commit 26c7e97

Browse files
committed
Docker GitHub Pages.
1 parent 99712f2 commit 26c7e97

2 files changed

Lines changed: 51 additions & 0 deletions

File tree

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
title: "Docker GitHub Pages"
3+
excerpt: A Docker container image and startup profile to run GitHub Pages locally during development...
4+
image: &image "/assets/images/philippe-oursel-06y6wukkSKg-unsplash.jpg"
5+
categories: GitHub Docker
6+
tags: GitHub Docker
7+
header:
8+
teaser: *image
9+
overlay_image: *image
10+
overlay_filter: 0.5
11+
toc: true
12+
toc_sticky: true
13+
---
14+
15+
This site (along with many others) is run using GitHub Pages.
16+
17+
GitHub Pages hosts static websites. It could be about yourself, a project, or a business. GitHub Pages [prohibits](https://docs.github.com/en/pages/getting-started-with-github-pages/about-github-pages#prohibited-uses) use for running an online business, e-commerce site or anything primarily directed as commercial transactions or Software as a Service. For more information on GitHub Pages, see [GitHub Pages documentation](https://docs.github.com/en/pages).
18+
19+
Before sending my site updates to GitHub for publishing, I like to preview it locally. GitHub Pages uses Jeylll (a framework for building static websites). Running Jekyll should be quite easy. Install Ruby, some Ruby gems (Bundler, Jekyll and the GitHub Pages plugins) and I can preview my updates locally.
20+
21+
# My Ageing Workstation
22+
23+
I have an Apple MacBook Pro (Mid 2015) as my main workstation. Its almost 10 years old now, but still serves me well. However, it will only run macOS Monterey (v12.7.6 at the time of writing). I have tried [OpenCore Legacy Patcher](https://dortania.github.io/OpenCore-Legacy-Patcher/) with Sequoia but I had network stability issues and WebGL failed to work in Safari for me.
24+
25+
I recently wiped and rebuilt the laptop to clear out lots of old clutter. During re-install, I went to setup my GitHub Pages development environment. This involves using Homebrew to install the correct version of Ruby, Bundle and Jekyll.
26+
27+
This is when I found that as of October this year (2024), Homebrew no longer supported macOS Monterey.
28+
29+
Docker however, runs fine on this ageing old workstation.
30+
31+
# What is Docker?
32+
33+
Docker allows developers to build, test applications and deploy applications. In Docker, an image of everything required to run an application is packaged and used to create a standard container that runs in a virtual machine. For more information on Docker, see the [Docker documentation](https://www.docker.com).
34+
35+
I can use Docker to host a local development environment to preview my GitHub Pages websites.
36+
37+
![GitHub Pages in Docker](https://www.jsware.io/docker-github-pages/assets/images/GitHub-Pages.gif)
38+
39+
# Creating a GitHub Pages container
40+
41+
This turned out to be relatively easy. I did the following:
42+
43+
1. Install Docker Desktop
44+
2. Create a Dockerfile that
45+
1. Started with Ruby 3.3.4 (The version used by [GitHub Pages](https://pages.github.com/versions/))
46+
2. Install the GitHub Pages gem bundle
47+
3. Copied a start script to start Jekyll with the site mounted into the /home directory.
48+
3. Build the Docker image.
49+
4. Create and run a container from the directory.
50+
51+
For more information, see the [Docker GitHub Pages](https://www.jsware.io/docker-github-pages/) documentation.
174 KB
Loading

0 commit comments

Comments
 (0)