Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
_site
.sass-cache
.jekyll-cache
.jekyll-metadata
.git
.github
.claude
vendor
node_modules
bower_components
*.xcf
.DS_Store
.idea
.cursor
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 6 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: ''
Expand Down
32 changes: 32 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
services:
jekyll:
build: .
volumes:
- .:/site
- bundle_cache:/usr/local/bundle
environment:
- JEKYLL_ENV=${JEKYLL_ENV:-development}

serve:
extends:
service: 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:
service: jekyll
command: bundle exec jekyll build --watch --incremental --force_polling
profiles: [dev]

build:
extends:
service: jekyll
command: bundle exec jekyll build
profiles: [build]

volumes:
bundle_cache:
45 changes: 45 additions & 0 deletions run
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/usr/bin/env bash
set -euo pipefail

usage() {
cat <<EOF
Usage: ./run <command>

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