You've already forked hugo-docker
mirror of
https://github.com/jakejarvis/hugo-docker.git
synced 2025-07-01 22:46:41 -04:00
Compare commits
34 Commits
Author | SHA1 | Date | |
---|---|---|---|
af6f3b8139
|
|||
669722c47a
|
|||
e98baa7dc4
|
|||
755a524c55
|
|||
18e51db24a | |||
ebe3e97c81 | |||
22e644d81d | |||
4d1191ce2b | |||
9b9a34e059
|
|||
3d5a32a41a | |||
bdfadabde1
|
|||
ad2b89ae8e
|
|||
ad10482235
|
|||
4a98dad700
|
|||
e91bc2ed98 | |||
048f5d17f2
|
|||
5c457e33fe
|
|||
0a8ca90615
|
|||
8b514c58d7
|
|||
20f98c58b7
|
|||
a10483b36a
|
|||
e5a6870534
|
|||
62b12c0d22
|
|||
df27582975
|
|||
6cc3f39751
|
|||
8540c876dd
|
|||
e806604521
|
|||
7fc2ac2b8e
|
|||
56a30dab8f
|
|||
f49e3b1dcd
|
|||
2de4b89509
|
|||
10103bce3b
|
|||
fcb292357c
|
|||
61fa24ed38
|
96
.github/workflows/build.yml
vendored
96
.github/workflows/build.yml
vendored
@ -4,79 +4,89 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
tags:
|
||||
- 'v*'
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
merge_group:
|
||||
workflow_dispatch:
|
||||
|
||||
# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-only-cancel-in-progress-jobs-or-runs-for-the-current-workflow
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
|
||||
env:
|
||||
HUB_IMAGE: jakejarvis/hugo-extended
|
||||
GHCR_IMAGE: ghcr.io/jakejarvis/hugo-extended
|
||||
|
||||
jobs:
|
||||
docker:
|
||||
runs-on: ubuntu-latest
|
||||
if: "!contains(github.event.head_commit.message, '[skip ci]')"
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Prepare tags
|
||||
id: tag
|
||||
env:
|
||||
HUB_IMAGE: jakejarvis/hugo-extended
|
||||
GHCR_IMAGE: ghcr.io/jakejarvis/hugo-extended
|
||||
run: |
|
||||
TAGS="${HUB_IMAGE}:latest,${GHCR_IMAGE}:latest"
|
||||
|
||||
# If triggered by a new tag, add a version tag to the image
|
||||
if [[ $GITHUB_REF == refs/tags/* ]]; then
|
||||
VERSION=${GITHUB_REF#refs/tags/v}
|
||||
TAGS="$TAGS,${HUB_IMAGE}:${VERSION},${GHCR_IMAGE}:${VERSION}"
|
||||
fi
|
||||
|
||||
# Set output parameters
|
||||
echo ::set-output name=tags::${TAGS}
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@master
|
||||
with:
|
||||
platforms: all
|
||||
uses: docker/setup-qemu-action@v2
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
id: buildx
|
||||
uses: docker/setup-buildx-action@master
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Login to DockerHub
|
||||
if: ${{ github.ref == 'refs/heads/master' }}
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: jakejarvis
|
||||
password: ${{ secrets.DOCKER_HUB_TOKEN }}
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
if: ${{ github.ref == 'refs/heads/master' }}
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GHCR_PAT }}
|
||||
|
||||
- name: Cache Docker layers
|
||||
uses: actions/cache@v2
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: /tmp/.buildx-cache
|
||||
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-buildx-
|
||||
|
||||
- name: Login to DockerHub
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
username: jakejarvis
|
||||
password: ${{ secrets.DOCKER_HUB_TOKEN }}
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GHCR_PAT }}
|
||||
- name: Parse Hugo version
|
||||
id: parse_version
|
||||
run: |
|
||||
HUGO_VERSION="$(grep -oP '(?<=^ARG HUGO_VERSION=).+$' Dockerfile)"
|
||||
echo "HUGO_VERSION=$HUGO_VERSION" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Build and push
|
||||
id: build
|
||||
uses: docker/build-push-action@v2
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
builder: ${{ steps.buildx.outputs.name }}
|
||||
context: ./
|
||||
context: .
|
||||
file: ./Dockerfile
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: ${{ steps.tag.outputs.tags }}
|
||||
push: ${{ github.ref == 'refs/heads/master' }}
|
||||
tags: "${{ env.HUB_IMAGE }}:latest,${{ env.GHCR_IMAGE }}:latest,${{ env.HUB_IMAGE }}:${{ steps.parse_version.outputs.HUGO_VERSION }},${{ env.GHCR_IMAGE }}:${{ steps.parse_version.outputs.HUGO_VERSION }}"
|
||||
cache-from: type=local,src=/tmp/.buildx-cache
|
||||
cache-to: type=local,dest=/tmp/.buildx-cache
|
||||
|
||||
- name: Image digest
|
||||
run: echo ${{ steps.build.outputs.digest }}
|
||||
|
||||
- name: Update hub description
|
||||
uses: peter-evans/dockerhub-description@v3
|
||||
if: ${{ github.ref == 'refs/heads/master' }}
|
||||
with:
|
||||
username: jakejarvis
|
||||
password: ${{ secrets.DOCKER_HUB_TOKEN }}
|
||||
repository: ${{ env.HUB_IMAGE }}
|
||||
short-description: "✏️ Hugo Extended for x64 and ARM64 with PostCSS, Babel, Pandoc, and more baked in."
|
||||
readme-filepath: ./README.md
|
||||
enable-url-completion: true
|
||||
|
28
Dockerfile
28
Dockerfile
@ -1,15 +1,14 @@
|
||||
# the following version can be overridden at image build time with --build-arg
|
||||
ARG HUGO_VERSION=0.101.0
|
||||
# renovate: datasource=github-releases depName=gohugoio/hugo
|
||||
ARG HUGO_VERSION=0.112.3
|
||||
|
||||
# remove/comment the following line completely to compile vanilla Hugo:
|
||||
ARG HUGO_BUILD_TAGS=extended
|
||||
|
||||
# Hugo >= v0.81.0 requires Go 1.16+ to build
|
||||
ARG GO_VERSION=1.18
|
||||
ARG ALPINE_VERSION=3.15
|
||||
|
||||
# ---
|
||||
|
||||
FROM golang:${GO_VERSION}-alpine${ALPINE_VERSION} AS build
|
||||
# Hugo >= v0.81.0 requires Go 1.16+ to build
|
||||
FROM golang:1.20-alpine3.18 AS build
|
||||
|
||||
# renew global args from above
|
||||
# https://docs.docker.com/engine/reference/builder/#scope
|
||||
@ -28,8 +27,7 @@ RUN apk add --update --no-cache \
|
||||
gcc \
|
||||
g++ \
|
||||
musl-dev \
|
||||
git && \
|
||||
go install github.com/magefile/mage@latest
|
||||
git
|
||||
|
||||
# clone source from Git repo:
|
||||
RUN git clone \
|
||||
@ -38,7 +36,9 @@ RUN git clone \
|
||||
--depth 1 \
|
||||
https://github.com/gohugoio/hugo.git ./
|
||||
|
||||
RUN mage -v hugo && mage install
|
||||
# https://github.com/gohugoio/hugo/commit/241481931f5f5f2803cd4be519936b26d8648dfd
|
||||
RUN go build -v -ldflags "-X github.com/gohugoio/hugo/common/hugo.vendorInfo=docker" -tags "$HUGO_BUILD_TAGS" && \
|
||||
mv ./hugo /go/bin/hugo
|
||||
|
||||
# fix potential stack size problems on Alpine
|
||||
# https://github.com/microsoft/vscode-dev-containers/blob/fb63f7e016877e13535d4116b458d8f28012e87f/containers/hugo/.devcontainer/Dockerfile#L19
|
||||
@ -47,14 +47,16 @@ RUN go install github.com/yaegashi/muslstack@latest && \
|
||||
|
||||
# ---
|
||||
|
||||
FROM alpine:${ALPINE_VERSION}
|
||||
FROM alpine:3.18
|
||||
|
||||
# renew global args from above & pin any dependency versions
|
||||
ARG HUGO_VERSION
|
||||
# https://github.com/jgm/pandoc/releases
|
||||
ARG PANDOC_VERSION=2.17.1.1
|
||||
# renovate: datasource=github-releases depName=jgm/pandoc
|
||||
ARG PANDOC_VERSION=3.1.2
|
||||
# https://github.com/sass/dart-sass-embedded/releases
|
||||
ARG DART_SASS_VERSION=1.49.9
|
||||
# renovate: datasource=github-releases depName=sass/dart-sass-embedded
|
||||
ARG DART_SASS_VERSION=1.62.1
|
||||
|
||||
LABEL version="${HUGO_VERSION}"
|
||||
LABEL repository="https://github.com/jakejarvis/hugo-docker"
|
||||
@ -121,6 +123,8 @@ RUN set -euo pipefail && \
|
||||
fi && \
|
||||
# clean up some junk
|
||||
rm -rf /tmp/* /var/tmp/* /var/cache/apk/* && \
|
||||
# tell git to trust /src
|
||||
git config --global --add safe.directory /src && \
|
||||
# make super duper sure that everything went OK, exit otherwise
|
||||
hugo env && \
|
||||
go version && \
|
||||
|
19
renovate.json
Normal file
19
renovate.json
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||
"extends": [
|
||||
"config:base"
|
||||
],
|
||||
"automerge": true,
|
||||
"platformAutomerge": true,
|
||||
"regexManagers": [
|
||||
{
|
||||
"fileMatch": [
|
||||
"^Dockerfile$"
|
||||
],
|
||||
"matchStrings": [
|
||||
"# renovate: datasource=(?<datasource>.*?) depName=(?<depName>.*?)( versioning=(?<versioning>.*?))?( registryUrl=(?<registryUrl>.*?))?\\s.*?_VERSION=(?<currentValue>.*)\\s"
|
||||
],
|
||||
"versioningTemplate": "{{#if versioning}}{{{versioning}}}{{else}}semver{{/if}}"
|
||||
}
|
||||
]
|
||||
}
|
Reference in New Issue
Block a user