diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..666fd04e --- /dev/null +++ b/.dockerignore @@ -0,0 +1,8 @@ +_site +.jekyll-cache +.jekyll-metadata +node_modules +vendor +.git +.github +tmp diff --git a/.github/workflows/jekyll.yml b/.github/workflows/jekyll.yml index bd2761ef..c83b823f 100644 --- a/.github/workflows/jekyll.yml +++ b/.github/workflows/jekyll.yml @@ -21,8 +21,15 @@ jobs: cache: 'npm' - run: npm install + - uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{steps.versions.outputs.ruby}} + bundler-cache: true + - name: Build - uses: jerryjvl/jekyll-build-action@v1 + env: + JEKYLL_ENV: production + run: bundle exec jekyll build - name: Tailscale uses: tailscale/github-action@v2 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c3e1e229..10e547f8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,12 +1,19 @@ # Contributing -This is a Jekyll site. Ruby is therefore required. `asdf` users can run `asdf install` and be on their way. +This is a Jekyll site. You can run it either with Docker (recommended — no local Ruby/Node setup) or directly on your machine. -The site is bundled with `bundler 2.0.x`. Ensure you have the correct major version: `bundle --version`. +## Development with Docker -## Development +Requires Docker with Compose. -The standard Jekyll commands apply. +- To start, run `docker compose up` (add `--build` after Gemfile or package.json changes) +- The website will be available at `http://localhost:4000/` +- Edit any file and the website should reload automatically +- Stop: `docker compose down` + +## Development without Docker + +Ruby and Node are required. `asdf` users can run `asdf install` and be on their way. The site is bundled with `bundler 2.3.x` — ensure you have the correct major version: `bundle --version`. - Install dependencies: `bundle` and `npm install`. - Run a development server: `bundle exec jekyll server`. diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..adbdff30 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +FROM node:16-bullseye-slim AS node + +FROM ruby:3.0.3-slim-bullseye + +COPY --from=node /usr/local/bin/node /usr/local/bin/node +COPY --from=node /usr/local/bin/npm /usr/local/bin/npm +COPY --from=node /usr/local/lib/node_modules /usr/local/lib/node_modules + +RUN apt-get update && apt-get install -y --no-install-recommends \ + build-essential \ + git \ + && rm -rf /var/lib/apt/lists/* + +WORKDIR /app + +COPY Gemfile Gemfile.lock ./ +RUN bundle install + +COPY package.json package-lock.json ./ +RUN npm install + +CMD ["bundle", "exec", "jekyll", "server", "--host", "0.0.0.0", "--force_polling", "--livereload"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..ac1f1b15 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,15 @@ +services: + jekyll: + build: . + ports: + - "4000:4000" + - "35729:35729" + volumes: + - .:/app + - bundle_cache:/usr/local/bundle + - node_modules_cache:/app/node_modules + stdin_open: true + +volumes: + bundle_cache: + node_modules_cache: