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 <stirnamanj@gmail.com>

* docs: fixup readme style

Co-authored-by: Jason Stirnaman <stirnamanj@gmail.com>

* docs: fixup readme style

Co-authored-by: Jason Stirnaman <stirnamanj@gmail.com>

---------

Co-authored-by: Jason Stirnaman <stirnamanj@gmail.com>
pull/5403/head^2
wayne 2024-04-01 11:17:07 -06:00 committed by GitHub
parent 8f3947ec92
commit 86f832f06c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 30 additions and 2 deletions

View File

@ -52,3 +52,16 @@ including our GPG key, can be found at https://www.influxdata.com/how-to-report-
npx hugo server npx hugo server
``` ```
5. View the docs at [localhost:1313](http://localhost:1313). 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).

View File

@ -1,5 +1,5 @@
# For examples, see the Awesome Compose repository: # This is a Docker Compose file for the InfluxData documentation site.
# https://github.com/docker/awesome-compose ## Run documentation tests for code samples.
services: services:
test: test:
image: docs-v2-tests image: docs-v2-tests
@ -19,3 +19,18 @@ services:
args: args:
- SOURCE_DIR=test - SOURCE_DIR=test
- DOCKER_IMAGE=docs-v2-tests - 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