mirror of https://github.com/docker/docs.git
contribute: update to use compose watch
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
This commit is contained in:
parent
2d8290fa5e
commit
c379bec61b
|
@ -20,6 +20,9 @@ FROM base as build-base
|
||||||
COPY --from=hugo $GOPATH/bin/hugo /bin/hugo
|
COPY --from=hugo $GOPATH/bin/hugo /bin/hugo
|
||||||
COPY --from=node /src/node_modules /src/node_modules
|
COPY --from=node /src/node_modules /src/node_modules
|
||||||
|
|
||||||
|
FROM build-base as dev
|
||||||
|
COPY . .
|
||||||
|
|
||||||
FROM build-base as build
|
FROM build-base as build
|
||||||
ARG HUGO_ENV
|
ARG HUGO_ENV
|
||||||
ARG DOCS_URL
|
ARG DOCS_URL
|
||||||
|
|
12
compose.yaml
12
compose.yaml
|
@ -2,10 +2,14 @@ services:
|
||||||
server:
|
server:
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
target: build-base
|
target: dev
|
||||||
volumes:
|
|
||||||
- "${PWD}:/src"
|
|
||||||
- /src/node_modules
|
|
||||||
ports:
|
ports:
|
||||||
- "1313:1313"
|
- "1313:1313"
|
||||||
entrypoint: ["hugo", "server", "--bind", "0.0.0.0"]
|
entrypoint: ["hugo", "server", "--bind", "0.0.0.0"]
|
||||||
|
x-develop:
|
||||||
|
watch:
|
||||||
|
- action: sync
|
||||||
|
path: .
|
||||||
|
target: /src
|
||||||
|
ignore:
|
||||||
|
- node_modules/
|
||||||
|
|
|
@ -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:
|
On your local machine, clone the docs repository:
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
git clone {{% param "repo" %}}.git
|
$ git clone {{% param "repo" %}}.git
|
||||||
cd docs
|
$ cd docs
|
||||||
```
|
```
|
||||||
|
|
||||||
Then, build and run the documentation using [Docker Compose](../compose/index.md):
|
Then, build and run the documentation using [Docker Compose](../compose/index.md):
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
docker compose up -d --build
|
$ docker compose up -d --build
|
||||||
|
$ docker compose alpha watch
|
||||||
```
|
```
|
||||||
|
|
||||||
> **Note**
|
> **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.
|
>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
|
The [Docker Compose `watch`](../compose/file-watch.md) feature causes your
|
||||||
again. This rebuilds the docs, and updates the container with your changes:
|
running container to rebuild itself automatically when you make changes to your
|
||||||
|
content files.
|
||||||
|
|
||||||
```bash
|
To stop the development container:
|
||||||
docker compose up -d --build
|
|
||||||
```
|
|
||||||
|
|
||||||
To stop the staging container, use the `docker compose down` command:
|
1. In your terminal, press `<Ctrl+C>` to exit the file watch mode of Compose.
|
||||||
|
2. Stop the Compose services with the `docker compose down` command.
|
||||||
```bash
|
|
||||||
docker compose down
|
|
||||||
```
|
|
||||||
|
|
||||||
### Build the docs with deployment features enabled
|
### Build the docs with deployment features enabled
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue