From 07eda2bd2ab475f7fd4b33d02226db6f2ec0b5da Mon Sep 17 00:00:00 2001 From: Piotr Spieker Date: Fri, 4 Oct 2024 19:08:29 +0200 Subject: [PATCH 1/2] Add a docker image --- Dockerfile | 22 ++++++++++++++++++++++ _config.yml | 5 ++++- docker-compose.yaml | 8 ++++++++ 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 Dockerfile create mode 100644 docker-compose.yaml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000..c7f1da3049 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +# Start from a light-weight ruby image +FROM ruby:3.3.4-alpine + +# Install gcc, make and git +RUN apk add build-base git + +# Update config +ENV GEM_HOME=$HOME/gems PATH=$HOME/gems/bin:$PATH + +# Make directory for site +WORKDIR /site + +# The Jekyll server runs on port 4000 by default +EXPOSE 4000 + +# Install jekyll and the required gems for the site +COPY script/bootstrap /usr/local/bin +COPY Gemfile Gemfile.lock jekyll-theme-cayman.gemspec /site/ +RUN bootstrap + +# Run jekyll-serve for dynamic development +CMD [ "bundle", "exec", "jekyll", "serve", "--livereload", "--force_polling", "-H", "0.0.0.0", "-P", "4000"] \ No newline at end of file diff --git a/_config.yml b/_config.yml index 2a062d3e99..b24009e8b4 100644 --- a/_config.yml +++ b/_config.yml @@ -2,4 +2,7 @@ title: Cayman theme description: Cayman is a clean, responsive theme for GitHub Pages. show_downloads: true google_analytics: -theme: jekyll-theme-cayman \ No newline at end of file +theme: jekyll-theme-cayman +exclude: + - Dockerfile + - docker-compose.yaml \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000000..8f73ddef94 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,8 @@ +name: jekyll-theme-cayman-dev +services: + jekyll-theme-cayman-dev: + build: . + ports: + - 4000:4000 + volumes: + - .:/site \ No newline at end of file From 7275115a7743b8d952e56f224658151ac656d168 Mon Sep 17 00:00:00 2001 From: Piotr Spieker Date: Wed, 13 Nov 2024 12:47:48 +0100 Subject: [PATCH 2/2] Update Readme --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index 06a3b19320..73bc3039cf 100644 --- a/README.md +++ b/README.md @@ -111,6 +111,15 @@ If you'd like to preview the theme locally (for example, in the process of propo 4. Run `bundle exec jekyll serve` to start the preview server 5. Visit [`localhost:4000`](http://localhost:4000) in your browser to preview the theme +### Previewing the theme via Docker + +We also provide a Docker image for easy local setup: + +1. Clone down the theme's repository (`git clone https://github.com/pages-themes/cayman`) +2. `cd` into the theme's directory +3. Run `docker compose up --build` to build and run the Docker image +4. Visit [`localhost:4000`](http://localhost:4000) in your browser to preview the theme + ### Running tests The theme contains a minimal test suite, to ensure a site with the theme would build successfully. To run the tests, simply run `script/cibuild`. You'll need to run `script/bootstrap` once before the test script will work.