Docs: Fix building of docs (#23923)

* Docs: Fix building of docs
* CircleCI: Fixate grafana/docs-base image revision in job for building docs
This commit is contained in:
Arve Knudsen 2020-04-28 09:27:46 +02:00 committed by GitHub
parent 02140fff2d
commit 5442b0ab4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 19 deletions

View File

@ -840,7 +840,6 @@ jobs:
build-docs-website:
executor: grafana-build
working_directory: /docs
steps:
- checkout
- setup_remote_docker
@ -853,22 +852,23 @@ jobs:
apt-get update
apt-get install -y docker.io
- run:
name: Build grafana docs website
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'
IMAGE=grafana/docs-base@sha256:63758b74e3990ab61e274f5e98da092d5c38378829dad0488aa97c59f0144f34
# In order to copy sources into the remote container, we need to employ a trick of creating a container
# with a volume, that we copy the sources into. Then, we launch the build container, with the volume
# from the other container
docker create -v /hugo/content/docs/grafana --name docs alpine:3.11 /bin/true
docker cp ${PWD}/docs/sources docs:/hugo/content/docs/grafana/latest
docker run --volumes-from docs $IMAGE /bin/bash -c 'make prod'
- run:
name: CI job failed
command: "docker stop docs-website && docker rm docs-website && ./scripts/ci-job-failed.sh"
command: "./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"
command: "./scripts/ci-job-succeeded.sh"
when: on_success
deploy-to-kubernetes:

View File

@ -1,12 +1,9 @@
.PHONY: docs docs-no-pull docs-test
.PHONY: docs docs-test
IMAGE = grafana/docs-base@sha256:63758b74e3990ab61e274f5e98da092d5c38378829dad0488aa97c59f0144f34
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 /bin/bash -c 'npm i && make webpack && make docs-menu && hugo server -p 3002 -D --ignoreCache --baseUrl http://localhost:3002 --bind 0.0.0.0'
docs-no-pull:
docker run -v $(PWD)/sources:/hugo/content/docs/grafana/latest -p 3002:3002 --rm -it grafana/docs-base:latest /bin/bash -c 'make docs-menu && hugo server -p 3002 -D --ignoreCache --baseUrl http://localhost:3002 --bind 0.0.0.0'
docker run -v $(shell pwd)/sources:/hugo/content/docs/grafana/latest -p 3002:3002 --rm -it $(IMAGE) /bin/bash -c 'make server'
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'
docker run -v $(shell pwd)/sources:/hugo/content/docs/grafana/latest --rm -it $(IMAGE) /bin/bash -c 'make prod'