From d5d6b42f12048f8ae270d8295e9395ba36bfebb0 Mon Sep 17 00:00:00 2001 From: Tim Hostetler <6970899+thostetler@users.noreply.github.com> Date: Wed, 4 Mar 2026 09:35:57 -0500 Subject: [PATCH 1/2] Add an alternative docker-based config - Adds docker-compose config - Adds convenience './run' script - Updates README --- .dockerignore | 14 ++++++++++++++ Dockerfile | 15 +++++++++++++++ README.md | 14 ++++++++++++++ _config.yml | 6 ++++++ docker-compose.yml | 29 +++++++++++++++++++++++++++++ run | 45 +++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 123 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 docker-compose.yml create mode 100755 run diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..80eb7335 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,14 @@ +_site +.sass-cache +.jekyll-cache +.jekyll-metadata +.git +.github +.claude +vendor +node_modules +bower_components +*.xcf +.DS_Store +.idea +.cursor diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..fc41c788 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,15 @@ +FROM ruby:3.3-alpine + +RUN apk add --no-cache \ + build-base \ + git \ + && gem install bundler + +WORKDIR /site + +COPY Gemfile Gemfile.lock ./ +RUN bundle install --jobs 4 + +EXPOSE 4000 + +CMD ["bundle", "exec", "jekyll", "serve", "--host", "0.0.0.0"] diff --git a/README.md b/README.md index 9056ce9a..6d6ca1db 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,20 @@ After installing Jekyll, run the following commands to preview the site: You will now be able to access the help pages locally at `http://0.0.0.0:4000` or `localhost:4000` (default configuration). After the website is built for the first time, you should only need to save the file, wait a second or two for it to rebuild automatically (check the terminal window where you ran `jekyll serve`), then refresh the page to see any changes. +#### Development with Docker + +As an alternative, you can use Docker instead of installing Ruby locally. The only prerequisite is [Docker](https://docs.docker.com/get-docker/). A convenience script wraps the Docker Compose setup: + +``` +./run serve # start dev server at http://localhost:4000 (livereload) +./run build # one-shot production build +./run dev # watch + incremental rebuild (no server) +./run stop # stop running containers +./run clean # remove build artifacts and Docker volumes +``` + +`JEKYLL_PORT` and `JEKYLL_ENV` can be set as environment variables. + ### Maintainer Mugdha diff --git a/_config.yml b/_config.yml index b8209bd0..78db7b91 100644 --- a/_config.yml +++ b/_config.yml @@ -35,6 +35,12 @@ plugins: last-modified-at: date-format: '%Y-%m-%dT%H:%M:%S%:z' +exclude: + - Dockerfile + - docker-compose.yml + - run + - vendor + defaults: - scope: path: '' diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..45bc1ed6 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,29 @@ +services: + jekyll: + build: . + volumes: + - .:/site + - bundle_cache:/usr/local/bundle + environment: + - JEKYLL_ENV=${JEKYLL_ENV:-development} + + serve: + extends: jekyll + ports: + - "127.0.0.1:${JEKYLL_PORT:-4000}:4000" + - "127.0.0.1:35729:35729" + command: bundle exec jekyll serve --host 0.0.0.0 --livereload + profiles: [serve] + + dev: + extends: jekyll + command: bundle exec jekyll build --watch --incremental --force_polling + profiles: [dev] + + build: + extends: jekyll + command: bundle exec jekyll build + profiles: [build] + +volumes: + bundle_cache: diff --git a/run b/run new file mode 100755 index 00000000..3ca2d4ca --- /dev/null +++ b/run @@ -0,0 +1,45 @@ +#!/usr/bin/env bash +set -euo pipefail + +usage() { + cat < + +Commands: + serve Start dev server at http://127.0.0.1:4000 (livereload enabled) + dev Watch + incremental rebuild (no server) + build One-shot production build + stop Stop running containers + clean Remove built site, caches, and Docker volumes + +Environment: + JEKYLL_PORT Server port (default: 4000) + JEKYLL_ENV Jekyll environment (default: development) +EOF + exit 1 +} + +cmd="${1:-}" +shift || true + +case "$cmd" in + serve) + docker compose --profile serve up "$@" + ;; + dev) + docker compose --profile dev run --rm dev "$@" + ;; + build) + docker compose --profile build run --rm build "$@" + ;; + stop) + docker compose --profile serve down "$@" + ;; + clean) + docker compose --profile serve down -v "$@" + rm -rf _site .jekyll-cache .sass-cache + ;; + *) + usage + ;; +esac From 3e06b5748a64e380b4ad561cee05e20c7dd29bf2 Mon Sep 17 00:00:00 2001 From: Tim Hostetler <6970899+thostetler@users.noreply.github.com> Date: Thu, 5 Mar 2026 16:27:15 -0500 Subject: [PATCH 2/2] fix: correct docker-compose extends syntax and run script usage text - Use mapping form for extends (service: jekyll) per Compose spec - Fix usage text to reference ./run instead of ./site --- docker-compose.yml | 9 ++++++--- run | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 45bc1ed6..a09f7a6f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,7 +8,8 @@ services: - JEKYLL_ENV=${JEKYLL_ENV:-development} serve: - extends: jekyll + extends: + service: jekyll ports: - "127.0.0.1:${JEKYLL_PORT:-4000}:4000" - "127.0.0.1:35729:35729" @@ -16,12 +17,14 @@ services: profiles: [serve] dev: - extends: jekyll + extends: + service: jekyll command: bundle exec jekyll build --watch --incremental --force_polling profiles: [dev] build: - extends: jekyll + extends: + service: jekyll command: bundle exec jekyll build profiles: [build] diff --git a/run b/run index 3ca2d4ca..883c71d2 100755 --- a/run +++ b/run @@ -3,7 +3,7 @@ set -euo pipefail usage() { cat < +Usage: ./run Commands: serve Start dev server at http://127.0.0.1:4000 (livereload enabled)