initial commit

This commit is contained in:
Sthope 2021-09-06 18:18:28 +02:00
parent 34cebd627f
commit 2d42b6a3a2
2 changed files with 61 additions and 28 deletions

View File

@ -1,12 +1,24 @@
# kind: pipeline
# name: default
# steps:
# - name: build
# image: plugins/hugo
# settings:
# hugo_version: 0.88.1
# pull: always
# validate: true
# config: blog/config.toml
# theme: /drone/src/blog/themes
---
kind: pipeline
name: default
type: docker
steps:
- name: build
image: plugins/hugo
settings:
hugo_version: 0.88.1
pull: always
validate: true
config: blog/config.toml
theme: /drone/src/blog/themes
- name: test
image: plugins/hugo
settings:
validate: true
pull: always
source: blog/

View File

@ -1,24 +1,45 @@
FROM alpine:latest
LABEL maintainer="Sthope <HopelessAutomations@gmail.com>"
# GitHub: https://github.com/gohugoio
# Twitter: https://twitter.com/gohugoio
# Website: https://gohugo.io/
RUN apk add --no-cache \
curl \
git \
openssh-client \
rsync \
build-base \
libc6-compat
FROM golang:1.16-alpine AS build
RUN HUGO=$(curl -s "https://api.github.com/repos/gohugoio/hugo/releases/latest" | awk -F '"' '/tag_name/{print $4}'| sed -E 's/v//g;') && \
export HUGO && \
mkdir -p /usr/local/src && \
cd /usr/local/src && \
curl -L "https://github.com/gohugoio/hugo/releases/download/v${HUGO}/hugo_extended_${HUGO}_linux-64bit.tar.gz" | tar -xz && \
mv hugo /usr/local/bin/hugo && \
addgroup -Sg 1000 hugo && \
adduser -Sg hugo -u 1000 -h /src hugo
# Optionally set HUGO_BUILD_TAGS to "extended" or "nodeploy" when building like so:
# docker build --build-arg HUGO_BUILD_TAGS=extended .
ARG HUGO_BUILD_TAGS
WORKDIR /src
ARG CGO=1
ENV CGO_ENABLED=${CGO}
ENV GOOS=linux
ENV GO111MODULE=on
WORKDIR /go/src/github.com/gohugoio/hugo
COPY . /go/src/github.com/gohugoio/hugo/
# 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
# ---
FROM alpine:3.12
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"]