30 lines
802 B
Docker
30 lines
802 B
Docker
FROM alpine:latest as builder
|
|
|
|
# Hugo versions
|
|
ENV HUGO_VERSION 0.88.1
|
|
ENV HUGO_BINARY hugo_${HUGO_VERSION}_linux-64bit
|
|
|
|
# Install pygments for code highlighting
|
|
RUN apk update && apk add py-pygments && apk add bash && rm -rf /var/cache/apk/*
|
|
|
|
# Install Hugo
|
|
RUN mkdir /usr/local/hugo
|
|
ADD https://github.com/spf13/hugo/releases/download/v${HUGO_VERSION}/${HUGO_BINARY}.tar.gz /usr/local/hugo/
|
|
RUN tar xzf /usr/local/hugo/${HUGO_BINARY}.tar.gz -C /usr/local/hugo/ \
|
|
&& ln -s /usr/local/hugo/hugo /usr/local/bin/hugo \
|
|
&& rm /usr/local/hugo/${HUGO_BINARY}.tar.gz
|
|
|
|
# Copy hugo site
|
|
WORKDIR /app
|
|
COPY site/ /app
|
|
|
|
# Build site
|
|
RUN hugo --minify --enableGitInfo --gc -d /app/build
|
|
|
|
|
|
# Create the webserver
|
|
FROM nginx:latest
|
|
|
|
# Copy built files
|
|
COPY --from=builder /app/build /usr/share/nginx/html
|
|
EXPOSE 80 |