1
mirror of https://github.com/jakejarvis/hugo-docker.git synced 2025-04-26 08:25:20 -04:00

forking a vanilla Docker image from the GH action repo

This commit is contained in:
Jake Jarvis 2020-07-26 10:34:47 -04:00
parent d7339726c5
commit d719294af7
Signed by: jake
GPG Key ID: 2B0C9CF251E69A39
4 changed files with 36 additions and 63 deletions

View File

@ -1,22 +0,0 @@
name: Build docs
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout action
uses: actions/checkout@master
with:
fetch-depth: 1
- name: Checkout gohugoio/hugoDocs
uses: actions/checkout@master
with:
repository: gohugoio/hugoDocs
path: docs/
fetch-depth: 1
- name: Build site
uses: ./
with:
args: --source docs/ --minify --enableGitInfo --verbose

View File

@ -7,13 +7,8 @@ ARG HUGO_VERSION=0.74.3
# remove/comment the following line completely to build with vanilla Hugo: # remove/comment the following line completely to build with vanilla Hugo:
ARG HUGO_EXTENDED=1 ARG HUGO_EXTENDED=1
LABEL "com.github.actions.name"="Hugo Build" LABEL version="${HUGO_VERSION}"
LABEL "com.github.actions.description"="Hugo as an action, with extended support and legacy versions" LABEL repository="https://github.com/jakejarvis/hugo-docker"
LABEL "com.github.actions.icon"="edit"
LABEL "com.github.actions.color"="gray-dark"
LABEL version="${HUGO_VERSION}${HUGO_EXTENDED:+-extended}"
LABEL repository="https://github.com/jakejarvis/hugo-build-action"
LABEL homepage="https://jarv.is/" LABEL homepage="https://jarv.is/"
LABEL maintainer="Jake Jarvis <jake@jarv.is>" LABEL maintainer="Jake Jarvis <jake@jarv.is>"
@ -42,7 +37,7 @@ RUN apk update && \
chmod +x /usr/local/bin/hugo && \ chmod +x /usr/local/bin/hugo && \
rm -rf hugo_* LICENSE README.md rm -rf hugo_* LICENSE README.md
# verify everything's OK, fail otherwise # verify everything's OK, exit otherwise
RUN hugo version && \ RUN hugo version && \
hugo env && \ hugo env && \
postcss --version && \ postcss --version && \
@ -51,4 +46,11 @@ RUN hugo version && \
pygmentize -V && \ pygmentize -V && \
asciidoctor --version asciidoctor --version
# add site source as volume
VOLUME /src
WORKDIR /src
# expose live-refresh server
EXPOSE 1313
ENTRYPOINT ["hugo"] ENTRYPOINT ["hugo"]

View File

@ -1,35 +1,37 @@
# GitHub Action for [Hugo](https://github.com/gohugoio/hugo) ✏️ # ✏️ [Hugo](https://github.com/gohugoio/hugo) via Docker
![Build docs](https://github.com/jakejarvis/hugo-build-action/workflows/Build%20docs/badge.svg) [![Build docs](https://img.shields.io/docker/cloud/build/jakejarvis/hugo-extended?label=Docker%20Hub&logo=docker&logoColor=%23fff)](https://hub.docker.com/r/jakejarvis/hugo-extended)
This is a simple GitHub Action that contains [Hugo](https://github.com/gohugoio/hugo), the popular static site generator. The [extended version](https://gohugo.io/troubleshooting/faq/#i-get-tocss-this-feature-is-not-available-in-your-current-hugo-version) is now bundled by default. Unlike other actions, this action includes releases going back to [v0.27](https://github.com/gohugoio/hugo/releases/tag/v0.27) (September 2017) for any compatibility requirements. A base image to ease local development of Hugo sites, including [Hugo Extended](https://gohugo.io/troubleshooting/faq/#i-get-tocss-this-feature-is-not-available-in-your-current-hugo-version) (with SASS/SCSS support) and third-party tools [listed below](#third-party-software).
## Usage ## Usage
### `workflow.yml` Example ### Command line
This example simply uploads the `./public` directory (the built Hugo website) as an artifact. You can replace the last `actions/upload-artifact` step with another action, like James Ives' [GitHub Pages deploy action](https://github.com/JamesIves/github-pages-deploy-action) or my [S3 sync action](https://github.com/jakejarvis/s3-sync-action), to upload the built static site somewhere accessible. ```bash
docker run -v $(pwd):/src -p 1313:1313 jakejarvis/hugo-extended:latest server --buildDrafts --buildFuture --bind 0.0.0.0
Replace the `master` in `uses: jakejarvis/hugo-build-action@master` to specify the Hugo version, back to [v0.27](https://github.com/gohugoio/hugo/releases/tag/v0.27), like `hugo-build-action@v0.27`. This might be necessary if a recent version broke compatibility with your site. Otherwise, you'll get the [latest version](https://github.com/gohugoio/hugo/releases).
The `with: args:` portion holds any [optional flags](https://gohugo.io/commands/hugo/). You can remove those two lines for a vanilla build.
```yaml
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: jakejarvis/hugo-build-action@master # ...or replace 'master' with a full version tag, such as: v0.64.1
with:
args: --minify --buildDrafts
- uses: actions/upload-artifact@master
with:
name: website
path: './public'
``` ```
## Included Software ### `docker-compose.yml`
```yaml
version: 3
services:
hugo:
image: jakejarvis/hugo-extended:latest
ports:
- 1313:1313
volumes:
- ./:/src
command: server --buildDrafts --buildFuture --bind 0.0.0.0
```
### Live server
When using Docker to run a live server (via `hugo server`), you must pass `--bind 0.0.0.0` as an argument to fix some networking quirks between Hugo, the container, and the host.
## Third-party software
Just in case, the final container includes a few small third-party tools that are required by certain optional Hugo features: Just in case, the final container includes a few small third-party tools that are required by certain optional Hugo features:

View File

@ -1,9 +0,0 @@
name: "Hugo Build"
description: "Hugo as an action, with extended support and legacy versions"
author: jakejarvis
runs:
using: docker
image: Dockerfile
branding:
icon: edit
color: gray-dark