Skip to content

Commit f0a954b

Browse files
committed
add docs-serve task for local Jekyll preview via Docker
Add 'task docs-serve' that runs Jekyll in a Docker container so developers can preview the documentation site without installing Ruby or Jekyll locally. Uses a _config.dev.yml override to clear the baseurl for local serving at http://localhost:4000 with LiveReload enabled. Assisted-By: docker-agent
1 parent c93019a commit f0a954b

4 files changed

Lines changed: 24 additions & 0 deletions

File tree

Taskfile.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,18 @@ tasks:
8686
desc: Build and Push Docker image
8787
cmd: docker buildx build --push --platform linux/amd64,linux/arm64 -t docker/docker-agent {{.BUILD_ARGS}} .
8888

89+
docs-serve:
90+
desc: Preview the Jekyll documentation site locally
91+
dir: docs
92+
cmd: |
93+
docker build -t docker-agent-docs . && \
94+
docker run --rm \
95+
-v "{{.TASKFILE_DIR}}/docs:/srv/jekyll" \
96+
-e JEKYLL_ENV=development \
97+
-p 4000:4000 \
98+
docker-agent-docs \
99+
jekyll serve --host 0.0.0.0 --config _config.yml,_config.dev.yml --livereload
100+
89101
record-demo:
90102
desc: Record demo gif
91103
cmd: vhs ./docs/recordings/demo.tape

docs/Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FROM jekyll/jekyll:4
2+
3+
COPY Gemfile Gemfile.lock* ./
4+
RUN bundle install
5+
6+
EXPOSE 4000
7+
CMD ["jekyll", "serve", "--host", "0.0.0.0", "--livereload"]

docs/_config.dev.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Override for local development preview
2+
# Clears the baseurl so pages are served at the root
3+
baseurl: ""

docs/_config.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ exclude:
3636
- .markdownlint-cli2.yaml
3737
- .prettierrc
3838
- .prettierignore
39+
- _config.dev.yml
40+
- Dockerfile
3941

4042
# Default front matter
4143
defaults:

0 commit comments

Comments
 (0)