diff --git a/.circleci/config.yml b/.circleci/config.yml index 1406a2d1e13..73640f16085 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -437,6 +437,40 @@ jobs: command: './scripts/ci-job-succeeded.sh' when: on_success + build-docs-website: + docker: + - image: grafana/build-container:1.2.13 + working_directory: /docs + steps: + - checkout + - setup_remote_docker + - run: + name: ci job started + command: './scripts/ci-job-started.sh' + - run: + name: install docker + command: | + apt-get update + apt-get install -y docker.io + - run: + name: build grafana docs website + command: | + # https://circleci.com/docs/2.0/building-docker-images/#mounting-folders + # create a dummy container which will hold a volume with config + docker create -v /hugo/content/docs/grafana --name docs-website alpine:3.4 /bin/true + # copy a config file into this volume + docker cp ${PWD}/docs/sources docs-website:/hugo/content/docs/grafana/latest + # start an application container using this volume + docker run --volumes-from docs-website --rm -it grafana/docs-base:latest /bin/bash -c 'npm i && make prod' + - run: + name: ci job failed + command: 'docker stop docs-website && docker rm docs-website && ./scripts/ci-job-failed.sh' + when: on_fail + - run: + name: ci job succeeded + command: 'docker stop docs-website && docker rm docs-website && ./scripts/ci-job-succeeded.sh' + when: on_success + build-fast-package: docker: - image: grafana/build-container:1.2.13 @@ -1321,6 +1355,8 @@ workflows: - postgres-integration-test - cache-server-test filters: *filter-not-release-or-master + - build-docs-website: + filters: *filter-not-release-or-master nightly: triggers: - schedule: diff --git a/docs/Makefile b/docs/Makefile index 10f036c4c0a..8eb2cbd6eab 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -1,5 +1,9 @@ -.PHONY: docs +.PHONY: docs docs-test docs: docker pull grafana/docs-base:latest - docker run -v $(PWD)/sources:/hugo/content/docs/grafana/latest -p 3002:3002 --rm -it grafana/docs-base:latest + docker run -v $(PWD)/sources:/hugo/content/docs/grafana/latest -p 3002:3002 --rm -it grafana/docs-base:latest /bin/bash -c 'npm i && make webpack && hugo server -p 3002 -D --ignoreCache --baseUrl http://localhost:3002 --bind 0.0.0.0' + +docs-test: + docker pull grafana/docs-base:latest + docker run -v $(PWD)/sources:/hugo/content/docs/grafana/latest --rm -it grafana/docs-base:latest /bin/bash -c 'npm i && make prod' \ No newline at end of file diff --git a/docs/README.md b/docs/README.md index cc27da47d46..ff0e68a2cb6 100644 --- a/docs/README.md +++ b/docs/README.md @@ -23,7 +23,7 @@ Use the Hugo shortcode [relref](https://gohugo.io/content-management/cross-refer ### Edit the side menu -Edit [sources/menu.yaml](sources/menu.yaml) to make changes to the sidebar. Restart the `make run` command for changes to take effect. +Edit [sources/menu.yaml](sources/menu.yaml) to make changes to the sidebar. Stop and rerun the `make docs` command for changes to take effect. ### Add images