initial commit
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Sthope 2021-09-06 18:27:19 +02:00
parent 8b6b000a0f
commit ffd63794fb

View File

@ -1,45 +1,30 @@
# GitHub: https://github.com/gohugoio FROM alpine:latest as builder
# Twitter: https://twitter.com/gohugoio
# Website: https://gohugo.io/
FROM golang:1.16-alpine AS build # Hugo versions
ENV HUGO_VERSION 0.88.1
ENV HUGO_BINARY hugo_${HUGO_VERSION}_linux-64bit
# Optionally set HUGO_BUILD_TAGS to "extended" or "nodeploy" when building like so: # Install pygments for code highlighting
# docker build --build-arg HUGO_BUILD_TAGS=extended . RUN apk update && apk add py-pygments && apk add bash && rm -rf /var/cache/apk/*
ARG HUGO_BUILD_TAGS
ARG CGO=1 # Install Hugo
ENV CGO_ENABLED=${CGO} RUN mkdir /usr/local/hugo
ENV GOOS=linux ADD https://github.com/spf13/hugo/releases/download/v${HUGO_VERSION}/${HUGO_BINARY}.tar.gz /usr/local/hugo/
ENV GO111MODULE=on 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
WORKDIR /drone/src/blog/blog/ # Copy hugo site
WORKDIR /app
COPY site/ /app
COPY . /drone/src/blog/blog/ # Build site
RUN hugo --minify --enableGitInfo --gc -d /app/build
# gcc/g++ are required to build SASS libraries for extended version
RUN apk update && \
apk add --no-cache gcc g++ musl-dev && \
go get github.com/magefile/mage
RUN mage hugo && mage install # Create the webserver
FROM nginx:latest
# --- # Copy built files
COPY --from=builder /app/build /usr/share/nginx/html
FROM alpine:3.12 EXPOSE 80
COPY --from=build /go/bin/hugo /usr/bin/hugo
# libc6-compat & libstdc++ are required for extended SASS libraries
# ca-certificates are required to fetch outside resources (like Twitter oEmbeds)
RUN apk update && \
apk add --no-cache ca-certificates libc6-compat libstdc++ git
VOLUME /site
WORKDIR /site
# Expose port for live server
EXPOSE 1313
ENTRYPOINT ["hugo"]
CMD ["--help"]