From 1931a7efd896893972a7d1598cff2e9b8127e15d Mon Sep 17 00:00:00 2001 From: Jake Jarvis Date: Tue, 8 Oct 2019 10:56:06 -0400 Subject: [PATCH] docker updates --- .github/workflows/gh-pages.yml | 6 ++-- Dockerfile | 51 +++------------------------------- README.md | 2 +- 3 files changed, 8 insertions(+), 51 deletions(-) diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index 255f73ba..8fba7959 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -14,9 +14,9 @@ jobs: fetch-depth: 1 lfs: false # pull from custom Hugo Extended image with opinionated changes - # Docker hub: https://hub.docker.com/r/jakejarvis/hugo-jarv.is - # base Dockerfile source: https://go.jarv.is/30KA6DS - - uses: docker://jakejarvis/hugo-jarv.is:v0.53-DEV + # Docker hub: https://hub.docker.com/r/jakejarvis/hugo-custom + # base Dockerfile source: https://go.jarv.is/hugo-dockerfile + - uses: docker://jakejarvis/hugo-custom:latest with: args: --gc --cleanDestinationDir - uses: jakejarvis/github-pages-deploy-action@master diff --git a/Dockerfile b/Dockerfile index 43e011e7..e01befb8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,54 +1,13 @@ # Custom Hugo Extended fork, pre-built on Docker Hub: -# https://hub.docker.com/r/jakejarvis/hugo-jarv.is -# Source for base Dockerfile: https://go.jarv.is/30KA6DS -# +# https://hub.docker.com/r/jakejarvis/hugo-custom +# Base Dockerfile source: https://go.jarv.is/hugo-dockerfile +# # Usage: # docker build -t jarv.is:develop -f Dockerfile . # docker run -v $(pwd):/src -p 1313:1313 jarv.is:develop # ...then open http://localhost:1313 for the live-refresh server. -FROM golang:1.12-alpine AS builder - -ARG HUGO_REPO=https://github.com/jakejarvis/hugo.git -# ARG HUGO_BRANCH=master -# ARG HUGO_COMMIT=a28865c -ARG HUGO_BUILD_TAGS=extended - -# CGO (and gcc/g++) required to build wellington/go-libsass -ARG CGO=1 -ENV CGO_ENABLED=${CGO} -ENV GOOS=linux -ENV GO111MODULE=on - -RUN apk update && \ - apk add --no-cache git gcc g++ musl-dev && \ - git clone $HUGO_REPO $GOPATH/src/github.com/gohugoio/hugo && \ - cd $GOPATH/src/github.com/gohugoio/hugo && \ - if [ ! -z "$HUGO_BRANCH" ]; then git checkout $HUGO_BRANCH; fi && \ - if [ ! -z "$HUGO_COMMIT" ]; then git reset --hard $HUGO_COMMIT; fi && \ - go get github.com/magefile/mage && \ - mage hugo && mage install && \ - rm -rf $GOPATH/src - -# verify we've built correctly -RUN /go/bin/hugo version - -# --- - -FROM alpine:3.10 - -COPY --from=builder /go/bin/hugo /usr/bin/hugo - -# install libc6-compat & libstdc++ since we're building extended Hugo -# https://gitlab.com/yaegashi/hugo/commit/22f0d5cbd6114210ba7835468facbdee60609aa2 -# Twitter oEmbed shortcode fails without ca-certificates (x509: certificate signed by unknown authority) -# https://github.com/google/go-github/issues/1049 -RUN apk update && \ - apk add --no-cache ca-certificates libc6-compat libstdc++ && \ - update-ca-certificates - -# verify we've copied correctly -RUN /usr/bin/hugo version +FROM jakejarvis/hugo-custom:latest # add site source as volume VOLUME /src @@ -58,6 +17,4 @@ WORKDIR /src EXPOSE 1313 ENTRYPOINT ["/usr/bin/hugo"] - -# remove before pushing to Docker Hub: CMD ["server", "--bind", "0.0.0.0", "--port", "1313"] diff --git a/README.md b/README.md index f04b1ee6..68552f16 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ I keep an ongoing list of [blog post ideas](https://github.com/jakejarvis/jarv.i ## Running a local testing server with Docker -This site runs a [custom version](https://github.com/jakejarvis/hugo) of [Hugo Extended](https://github.com/gohugoio/hugo) with a few (very opinionated) changes. To ensure consistency, the [`Dockerfile`](Dockerfile) in this repository will build my Hugo fork (forked from `v0.53-DEV`, [gohugo/hugo@`a28865c`](https://github.com/gohugoio/hugo/tree/a28865cfc3e296cf0ddd0bd6c1368fcdb2154d0f)) and run a live testing server. +This site runs a [custom version](https://github.com/jakejarvis/hugo-custom) of [Hugo Extended](https://github.com/gohugoio/hugo) with a few (very opinionated) changes. To ensure consistency, the [`Dockerfile`](Dockerfile) in this repository will pull my Hugo [fork](https://github.com/jakejarvis/hugo-custom) (forked from `v0.53-DEV`, [gohugo/hugo@`a28865c`](https://github.com/gohugoio/hugo/tree/a28865cfc3e296cf0ddd0bd6c1368fcdb2154d0f) and pre-built [on Docker Hub](https://hub.docker.com/r/jakejarvis/hugo-custom)) and run a live testing server. Run these commands on the root of this repository: