From 50876fbf7900092a87dcf38526e233df3d95f813 Mon Sep 17 00:00:00 2001 From: Chris Mills <7100370+chriscoffee@users.noreply.github.com> Date: Fri, 2 Nov 2018 16:11:11 +0000 Subject: [PATCH] Add Dockerfile for docs (#857) There's no official image for hugo, so lets make our own and have the Makefile build the Dockerfile Add some basic documentation I've added some simple documentation and tidied up the Dockerfile. I move the file to use best practice and reduced the size slightly. Personally I don't think we'll need to alter the address and not watch files as it's only going to be used for local development atm. It might be useful in future to move to being able to alter these if we're using this in production Don't use docs use hugo It would be confusing for people to docker pull the docs but not have any docs included in them. hugo as the name would make way more sense. Don't lock down to digest We should trust official libs, especially the alpine build. Signed-off-by: Chris M --- DEVELOPMENT.md | 13 +++++++++++++ Makefile | 4 ++-- docs/Dockerfile | 21 +++++++++++++++++++++ 3 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 docs/Dockerfile diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index a9f248b4..1ea53d1e 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -71,3 +71,16 @@ then you can run the unit tests: ```console make test-unit ``` + +# Run the docs + +To get started with developing the docs we provide a docker image which you can use from within the `/docs` directory. It should work on all platforms. To get it up and running: + +``` +docker run -it --rm \ + --name hugo-server \ + -p 1313:1313 \ + -v $(PWD):/src:cached \ + gomods/hugo + +``` diff --git a/Makefile b/Makefile index 8662a670..d698ba01 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,7 @@ run: build .PHONY: docs docs: - cd docs && hugo + docker build -t gomods/hugo -f docs/Dockerfile . .PHONY: setup-dev-env setup-dev-env: @@ -54,7 +54,7 @@ alldeps: docker-compose -p athensdev up -d minio docker-compose -p athensdev up -d jaeger echo "sleeping for a bit to wait for the DB to come up" - sleep 5 + sleep 5 .PHONY: dev dev: diff --git a/docs/Dockerfile b/docs/Dockerfile new file mode 100644 index 00000000..012c731f --- /dev/null +++ b/docs/Dockerfile @@ -0,0 +1,21 @@ +FROM alpine:3.8 + +ENV HUGO_VERSION=0.50 +ENV HUGO_BINARY=hugo_${HUGO_VERSION}_Linux-64bit.tar.gz + +ADD https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/${HUGO_BINARY} /tmp + +RUN tar -xf /tmp/${HUGO_BINARY} -C /tmp \ + && mv /tmp/hugo /usr/local/bin/hugo \ + && rm -rf /tmp/hugo_${HUGO_VERSION}_linux_amd64 \ + && rm -rf /tmp/${HUGO_BINARY} \ + && rm -rf /tmp/LICENSE.md \ + && rm -rf /tmp/README.md \ + && apk upgrade --update \ + && apk add --no-cache git asciidoctor libc6-compat libstdc++ ca-certificates + +WORKDIR /src + +CMD ["hugo", "server", "-s", "/src", "-b", "http://localhost:1313", "--bind", "0.0.0.0"] + +EXPOSE 1313