Created
August 13, 2018 13:41
-
-
Save cooperaj/7ce93a4a81857c76de913c086eaea15e to your computer and use it in GitHub Desktop.
Hugo docker build
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Build stage | |
FROM node:8 as build | |
ENV HUGO_VERSION 0.45 | |
# Install dependencies | |
RUN apt-get update && apt-get install -y \ | |
nasm && \ | |
curl -sLo hugo.tar.gz "https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_${HUGO_VERSION}_Linux-64bit.tar.gz" && \ | |
mkdir hugo && \ | |
tar xzf hugo.tar.gz -C hugo/ && \ | |
rm -r hugo.tar.gz && \ | |
mv hugo/hugo /usr/bin/hugo && \ | |
rm -r hugo/ | |
# Install asset building dependencies | |
COPY .npmrc themes/theme/package.json themes/theme/package-lock.json /build/themes/theme/ | |
RUN cd /build/themes/theme && npm i | |
# Build site | |
COPY . /build | |
RUN cd /build/themes/theme && \ | |
npm run production && \ | |
cd /build && \ | |
hugo | |
# Runtime stage | |
FROM nginx:mainline-alpine | |
WORKDIR /usr/share/nginx/html | |
COPY nginx.conf /etc/nginx/conf.d/default.conf | |
COPY --from=build /build/public/. . |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment