My public website https://www.chameth.com/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Dockerfile 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. ##
  2. ## Step 1 - add content and build with Hugo
  3. ##
  4. FROM debian:stretch as hugo
  5. RUN apt-get -qq update \
  6. && DEBIAN_FRONTEND=noninteractive apt-get -qq install -y --no-install-recommends python-pygments git ca-certificates asciidoc \
  7. && rm -rf /var/lib/apt/lists/*
  8. ENV HUGO_VERSION 0.53
  9. ENV HUGO_BINARY hugo_${HUGO_VERSION}_Linux-64bit.deb
  10. ADD https://github.com/spf13/hugo/releases/download/v${HUGO_VERSION}/${HUGO_BINARY} /tmp/hugo.deb
  11. RUN dpkg -i /tmp/hugo.deb \
  12. && rm /tmp/hugo.deb
  13. ADD site /tmp/site
  14. RUN hugo -b https://www.chameth.com/ -v -s /tmp/site -d /tmp/hugo && \
  15. cp /tmp/hugo/index.xml /tmp/hugo/feed.xml
  16. ##
  17. ## Step 2 - compress, minify, etc
  18. ##
  19. FROM debian:stretch as minify
  20. RUN apt-get update \
  21. && DEBIAN_FRONTEND=noninteractive apt-get -qq install -y --no-install-recommends yui-compressor tidy webp \
  22. && rm -rf /var/lib/apt/lists/*
  23. COPY --from=hugo /tmp/hugo /tmp/site
  24. ADD minify.sh /tmp/minify.sh
  25. RUN chown -R nobody:nogroup /tmp/site && chmod +x /tmp/minify.sh
  26. USER nobody:nogroup
  27. RUN /tmp/minify.sh
  28. ##
  29. ## Step 3 - host!
  30. ##
  31. FROM nginx:mainline-alpine AS nginx
  32. COPY --from=minify /tmp/site /usr/share/nginx/html
  33. ADD nginx.conf /etc/nginx/nginx.conf
  34. VOLUME /logs