From c379bec61ba8882e90fc7733efd4ebcdad56e6f3 Mon Sep 17 00:00:00 2001 From: David Karlsson <35727626+dvdksn@users.noreply.github.com> Date: Wed, 23 Aug 2023 15:42:54 +0200 Subject: [PATCH] contribute: update to use compose watch Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com> --- Dockerfile | 3 +++ compose.yaml | 12 ++++++---- content/contribute/contribute-guide.md | 31 ++++++++++++-------------- content/desktop/get-started.md | 2 +- 4 files changed, 26 insertions(+), 22 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0fe13761b1..cfeb2a17e7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,6 +20,9 @@ FROM base as build-base COPY --from=hugo $GOPATH/bin/hugo /bin/hugo COPY --from=node /src/node_modules /src/node_modules +FROM build-base as dev +COPY . . + FROM build-base as build ARG HUGO_ENV ARG DOCS_URL diff --git a/compose.yaml b/compose.yaml index d3213736c8..3c2f547c1a 100644 --- a/compose.yaml +++ b/compose.yaml @@ -2,10 +2,14 @@ services: server: build: context: . - target: build-base - volumes: - - "${PWD}:/src" - - /src/node_modules + target: dev ports: - "1313:1313" entrypoint: ["hugo", "server", "--bind", "0.0.0.0"] + x-develop: + watch: + - action: sync + path: . + target: /src + ignore: + - node_modules/ diff --git a/content/contribute/contribute-guide.md b/content/contribute/contribute-guide.md index 36bcadfedc..93ac20eb66 100644 --- a/content/contribute/contribute-guide.md +++ b/content/contribute/contribute-guide.md @@ -66,35 +66,32 @@ A Netlify test runs for each PR created against the `main` branch and deploys th On your local machine, clone the docs repository: -```bash -git clone {{% param "repo" %}}.git -cd docs +```console +$ git clone {{% param "repo" %}}.git +$ cd docs ``` Then, build and run the documentation using [Docker Compose](../compose/index.md): -```bash -docker compose up -d --build +```console +$ docker compose up -d --build +$ docker compose alpha watch ``` > **Note** > >You need Docker Compose to build and run the docs locally. Docker Compose is included with [Docker Desktop](../desktop/index.md). If you don't have Docker Desktop installed, follow the [instructions](../compose/install/index.md) to install Docker Compose. -When the container is built and running, visit [http://localhost:4000](http://localhost:4000) in your web browser to view the docs. +When the container is built and running, visit [http://localhost:1313](http://localhost:1313) in your web browser to view the docs. -To rebuild the docs after you made changes, run the `docker compose up` command -again. This rebuilds the docs, and updates the container with your changes: +The [Docker Compose `watch`](../compose/file-watch.md) feature causes your +running container to rebuild itself automatically when you make changes to your +content files. -```bash -docker compose up -d --build -``` +To stop the development container: -To stop the staging container, use the `docker compose down` command: - -```bash -docker compose down -``` +1. In your terminal, press `` to exit the file watch mode of Compose. +2. Stop the Compose services with the `docker compose down` command. ### Build the docs with deployment features enabled @@ -140,4 +137,4 @@ for your operating system. To enable the vale integration for your editor, insta The vale rules that implement the Docker style guide are included in the Docker docs repository, in the `.github/vale` directory. Vale will automatically apply these rules when invoked in this -repository. \ No newline at end of file +repository. diff --git a/content/desktop/get-started.md b/content/desktop/get-started.md index c364c30bda..fb7ea7749e 100644 --- a/content/desktop/get-started.md +++ b/content/desktop/get-started.md @@ -103,4 +103,4 @@ docker.io/molly/privateimage:latest - [Explore Docker Desktop](use-desktop/index.md) and its features. - Change your Docker Desktop settings -- [Browse common FAQs](faqs/general.md) \ No newline at end of file +- [Browse common FAQs](faqs/general.md)