A image with Hugo and some usefull tools to publish to AWS S3/CloudFront
2.7K
This image contain Hugo and some tools to publish to AWS S3/CloudFront:
We use this image in our internal Gitlab Pipeline to publish our site made with Hugo: https://blog.oxalide.io
Example of use:
build:
stage: build
image: oxalide/hugo:latest
script:
- hugo -t $HUGO_THEME -v --baseURL="xxxxxx" -d public/$CI_ENVIRONMENT_SLUG
- for i in `find public/$CI_ENVIRONMENT_SLUG/ -name "*.jpg"`; do jpegoptim -s --all-progressive $i; done
- find public/$CI_ENVIRONMENT_SLUG/ -name "*.png" | xargs optipng
- ( cd public/$CI_ENVIRONMENT_SLUG/css/ && for i in `ls *.css`; do yui-compressor $i -o $i; done )
FROM debian:jessie
RUN apt-get -qq update \
&& DEBIAN_FRONTEND=noninteractive apt-get -qq install -y --no-install-recommends python-pygments git ca-certificates jpegoptim optipng yui-compressor python-pip unzip \
&& pip install awscli \
&& pip install boto3 \
&& rm -rf /var/lib/apt/lists/*
# Download and install hugo
ENV HUGO_VERSION 0.20
ENV HUGO_BINARY hugo_${HUGO_VERSION}-64bit.deb
ADD https://github.com/spf13/hugo/releases/download/v${HUGO_VERSION}/${HUGO_BINARY} /tmp/hugo.deb
RUN dpkg -i /tmp/hugo.deb \
&& rm /tmp/hugo.deb
ADD https://downloads.rclone.org/rclone-current-linux-amd64.zip /tmp/rclone.zip
RUN cd /tmp \
&& unzip rclone.zip \
&& cp rclone-*-linux-amd64/rclone /usr/local/bin/ \
&& chmod +x /usr/local/bin/rclone \
&& rm -Rf /tmp/rclone*
ADD https://raw.githubusercontent.com/Oxalide/hugo-cloudfront-invalidation/master/hugo-cf-invalidation.py /usr/local/bin/hugo-cf-invalidation.py
# Create working directory
RUN mkdir /usr/share/blog
WORKDIR /usr/share/blog
# Expose default hugo port
EXPOSE 1313
# Automatically build site
ONBUILD ADD site/ /usr/share/blog
ONBUILD RUN hugo -d /usr/share/nginx/html/
# By default, serve site
ENV HUGO_BASE_URL http://localhost:1313
CMD hugo server -b ${HUGO_BASE_URL} --bind=0.0.0.0
Content type
Image
Digest
Size
169.9 MB
Last updated
over 9 years ago
docker pull oxalide/hugo