Skip to content

Commit

Permalink
provide hugo container and make target (#426)
Browse files Browse the repository at this point in the history
* provide hugo container and make target

* build target

* revert build target - need to fix this in the future
  • Loading branch information
jmazzitelli authored Oct 13, 2021
1 parent 742ad37 commit a111840
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 15 deletions.
27 changes: 25 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
FROM klakegg/hugo:ext-alpine
FROM registry.fedoraproject.org/fedora-minimal

RUN apk add git
ARG HUGO_VERSION

VOLUME /site
WORKDIR /site

# Avoid startup errors about missing AsciiDoctor
ARG ASCIIDOCTOR_VERSION=2.0.10
RUN microdnf -y install ruby
RUN gem install --no-document "asciidoctor:${ASCIIDOCTOR_VERSION}"

# Download, untar, and install Hugo
RUN microdnf -y install tar shadow-utils git nodejs \
&& microdnf clean all

ADD https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_Linux-64bit.tar.gz /hugo.tar.gz
RUN tar xzvf /hugo.tar.gz -C / \
&& rm /hugo.tar.gz \
&& mv /hugo /usr/bin/hugo

# Stuff for docsy
RUN npm -g -D install postcss postcss-cli autoprefixer

# Confirm hugo binary is available and show its version
RUN hugo version
20 changes: 20 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
HUGO_VERSION ?= 0.75.0
DORP ?= podman
KIALI_HUGO_IMAGE ?= kiali/hugo:latest

.prepare-force-build:
ifeq ($(DORP),docker)
@$(eval FORCE_BUILD ?= $(shell docker inspect ${KIALI_HUGO_IMAGE} > /dev/null 2>&1 || echo "true"))
else
@$(eval FORCE_BUILD ?= $(shell podman inspect ${KIALI_HUGO_IMAGE} > /dev/null 2>&1 || echo "true"))
endif

## build-hugo: Builds the hugo image if necessary. You can force a rebuild by setting the environment variable "FORCE_BUILD=true".
.PHONY: build-hugo
build-hugo: .prepare-force-build
@if [ "${FORCE_BUILD}" == "true" ]; then ${DORP} build --build-arg HUGO_VERSION=${HUGO_VERSION} -t ${KIALI_HUGO_IMAGE} . ; else echo "Will not rebuild the image [${KIALI_HUGO_IMAGE}]."; fi

## serve: If necessary, builds the image and then runs a hugo server on your local machine at localhost:1313
.PHONY: serve
serve: build-hugo
@${DORP} run -t -i --sig-proxy=true --rm -v "$(shell pwd)":/site:z -w /site -p 1313:1313 ${KIALI_HUGO_IMAGE} hugo serve --baseURL "http://localhost:1313/" --bind 0.0.0.0 --disableFastRender
13 changes: 0 additions & 13 deletions docker-compose.yaml

This file was deleted.

0 comments on commit a111840

Please sign in to comment.