1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-04-26 21:48:27 -04:00

docker updates

This commit is contained in:
Jake Jarvis 2019-10-08 10:56:06 -04:00
parent 6aa688c62e
commit 1931a7efd8
3 changed files with 8 additions and 51 deletions

View File

@ -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

View File

@ -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"]

View File

@ -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: