From 86f832f06ce815652c523cdd5ed14cee375e7bd1 Mon Sep 17 00:00:00 2001 From: wayne Date: Mon, 1 Apr 2024 11:17:07 -0600 Subject: [PATCH] docs: Add docker compose workflow for running docs locally (#5400) * docs: Add docker compose workflow for running docs locally * chore: Fixup compose.yaml for local build: - Added comments - Use the verbose mount syntax - Wrap /Users/ja/Documents/GitHub/docs-v2 in quotes for cross-platform compat. * docs: fixup readme style Co-authored-by: Jason Stirnaman * docs: fixup readme style Co-authored-by: Jason Stirnaman * docs: fixup readme style Co-authored-by: Jason Stirnaman --------- Co-authored-by: Jason Stirnaman --- README.md | 13 +++++++++++++ compose.yaml | 19 +++++++++++++++++-- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b9ed7737e..d24564c76 100644 --- a/README.md +++ b/README.md @@ -52,3 +52,16 @@ including our GPG key, can be found at https://www.influxdata.com/how-to-report- npx hugo server ``` 5. View the docs at [localhost:1313](http://localhost:1313). + +### Alternative: Use docker compose + +1. Clone this repository to your local machine. See how to [clone a repository](https://help.github.com/articles/cloning-a-repository/). + +2. Follow the instructions to [install Docker Desktop](https://docs.docker.com/desktop/) and [Docker Compose](https://docs.docker.com/compose/) to your local machine. + +3. Use Docker Compose to start the Hugo server in development mode--for example, enter the following command in your terminal: + + ```sh + docker compose up local-dev + ``` +4. View the docs at [localhost:1313](http://localhost:1313). diff --git a/compose.yaml b/compose.yaml index bdf2562cf..c963d729a 100644 --- a/compose.yaml +++ b/compose.yaml @@ -1,5 +1,5 @@ -# For examples, see the Awesome Compose repository: -# https://github.com/docker/awesome-compose +# This is a Docker Compose file for the InfluxData documentation site. +## Run documentation tests for code samples. services: test: image: docs-v2-tests @@ -19,3 +19,18 @@ services: args: - SOURCE_DIR=test - DOCKER_IMAGE=docs-v2-tests + ## Run InfluxData documentation with the hugo development server on port 1313. + ## For more information about the hugomods/hugo image, see + ## https://docker.hugomods.com/docs/development/docker-compose/ + local-dev: + image: hugomods/hugo:exts-0.123.8 + command: hugo server --bind 0.0.0.0 + ports: + - 1313:1313 + volumes: + - type: bind + source: "$PWD" + target: /src + - type: bind + source: $HOME/hugo_cache + target: /tmp/hugo_cache