1
mirror of https://github.com/jakejarvis/hugo-docker.git synced 2025-07-02 01:06:41 -04:00

Compare commits

...

19 Commits

Author SHA1 Message Date
51c9c67055 Hugo v0.80.0 2021-01-02 10:13:59 -05:00
a105355628 Hugo v0.79.1 2020-12-19 11:09:19 -05:00
3f5b9205b7 Hugo v0.79.0 2020-11-27 10:00:57 -05:00
fcadd19550 Hugo v0.78.2 2020-11-17 10:11:39 -05:00
a956a18e6c add org.opencontainers.image.source label
https://docs.github.com/en/free-pro-team@latest/packages/managing-container-images-with-github-container-registry/connecting-a-repository-to-a-container-image#connecting-a-repository-to-a-container-image-on-the-command-line
2020-11-17 09:22:42 -05:00
c6fc7fd110 Hugo v0.78.1 2020-11-05 09:26:03 -05:00
a649d18bcb Hugo v0.78.0 2020-11-03 08:43:43 -05:00
36f0af41e7 Hugo v0.77.0 (and Go 1.15) 2020-10-30 18:01:09 -04:00
230b5e857b Hugo v0.76.5 2020-10-15 13:25:02 -04:00
916ee35d62 Hugo v0.76.4 2020-10-12 12:12:53 -04:00
b3d62a43c5 Hugo v0.76.3 2020-10-12 12:12:19 -04:00
b460e6ff06 Hugo v0.76.2 2020-10-07 09:32:43 -04:00
e324a937f2 Hugo v0.76.1 2020-10-07 09:32:19 -04:00
03249b8201 Hugo v0.76.0 2020-10-07 09:31:38 -04:00
b2136f83bd explicitly install postcss, not just via postcss-cli (https://github.com/jakejarvis/hugo-build-action/issues/2) 2020-10-02 11:46:38 -04:00
1d0932a8be Hugo v0.75.1 2020-09-16 08:26:56 -04:00
7087fafa01 Hugo v0.75.0 2020-09-14 10:28:12 -04:00
e79e76c961 Create publish.yml 2020-09-02 12:25:22 -04:00
a80a8bb35e Update README.md 2020-07-26 10:43:41 -04:00
3 changed files with 74 additions and 10 deletions

52
.github/workflows/publish.yml vendored Normal file
View File

@ -0,0 +1,52 @@
name: Publish to GitHub Container Registry
on:
push:
# Publish `v*` tags as releases.
tags:
- v*
pull_request:
env:
IMAGE_NAME: hugo-extended
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build image
run: docker build . --file Dockerfile
# Push image to GitHub Container Registry
push:
runs-on: ubuntu-latest
if: github.event_name == 'push'
needs: build
steps:
- uses: actions/checkout@v2
- name: Build image
run: docker build . --file Dockerfile --tag $IMAGE_NAME
- name: Login to GitHub Container Registry
run: echo "${{ secrets.GHCR_PAT }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Push image to GitHub
run: |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
# Push image with both version tag and `latest` tag
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
docker tag $IMAGE_NAME $IMAGE_ID:latest
docker push $IMAGE_ID:$VERSION
docker push $IMAGE_ID:latest

View File

@ -1,9 +1,9 @@
# Hugo doesn't require Go to run, *except* if you're using Hugo Modules. It's
# much easier to install Node on the Go base image than vice-versa.
FROM golang:1.14-alpine
FROM golang:1.15-alpine
# the following version can be overridden at image build time with --build-arg
ARG HUGO_VERSION=0.74.3
ARG HUGO_VERSION=0.80.0
# remove/comment the following line completely to build with vanilla Hugo:
ARG HUGO_EXTENDED=1
@ -12,6 +12,9 @@ LABEL repository="https://github.com/jakejarvis/hugo-docker"
LABEL homepage="https://jarv.is/"
LABEL maintainer="Jake Jarvis <jake@jarv.is>"
# https://docs.github.com/en/free-pro-team@latest/packages/managing-container-images-with-github-container-registry/connecting-a-repository-to-a-container-image#connecting-a-repository-to-a-container-image-on-the-command-line
LABEL org.opencontainers.image.source https://github.com/jakejarvis/hugo-docker
# only install libc6-compat & libstdc++ if we're building extended Hugo
# https://gitlab.com/yaegashi/hugo/commit/22f0d5cbd6114210ba7835468facbdee60609aa2
RUN apk update && \
@ -25,8 +28,10 @@ RUN apk update && \
py3-pip \
ruby \
${HUGO_EXTENDED:+libc6-compat libstdc++} && \
update-ca-certificates && \
npm install --global postcss-cli autoprefixer @babel/core @babel/cli && \
update-ca-certificates
# download Hugo and miscellaneous optional dependencies
RUN npm install --global postcss postcss-cli autoprefixer @babel/core @babel/cli && \
pip3 install --upgrade Pygments==2.* && \
gem install asciidoctor && \
wget https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_${HUGO_EXTENDED:+extended_}${HUGO_VERSION}_Linux-64bit.tar.gz && \
@ -37,6 +42,11 @@ RUN apk update && \
chmod +x /usr/local/bin/hugo && \
rm -rf hugo_* LICENSE README.md
# fix potential stack size problems on Alpine
# https://github.com/microsoft/vscode-dev-containers/blob/fb63f7e016877e13535d4116b458d8f28012e87f/containers/hugo/.devcontainer/Dockerfile#L19
RUN go get github.com/yaegashi/muslstack && \
muslstack -s 0x800000 /usr/local/bin/hugo
# verify everything's OK, exit otherwise
RUN hugo version && \
hugo env && \

View File

@ -1,13 +1,15 @@
# ✏️ [Hugo](https://github.com/gohugoio/hugo) via Docker
# ✏️ [Hugo Extended](https://github.com/gohugoio/hugo) via Docker
[![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)
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).
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 optional third-party tools ([listed below](#third-party-software)).
## Usage
### Command line
This will start a live server at http://localhost:1313/ from the Hugo site in your current directory:
```bash
docker run -v $(pwd):/src -p 1313:1313 jakejarvis/hugo-extended:latest server --buildDrafts --buildFuture --bind 0.0.0.0
```
@ -15,7 +17,7 @@ docker run -v $(pwd):/src -p 1313:1313 jakejarvis/hugo-extended:latest server --
### `docker-compose.yml`
```yaml
version: 3
version: '3'
services:
hugo:
@ -27,9 +29,9 @@ services:
command: server --buildDrafts --buildFuture --bind 0.0.0.0
```
### Live server
### Notes
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.
When using Docker to run a live server (i.e. `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
@ -45,4 +47,4 @@ Node (with NPM and Yarn) and Go (for [Hugo Modules](https://gohugo.io/hugo-modul
## Licenses
This action is distributed under the [MIT License](LICENSE.md). Hugo is distributed under the [Apache License 2.0](https://github.com/gohugoio/hugo/blob/master/LICENSE).
This project is distributed under the [MIT License](LICENSE.md). Hugo is distributed under the [Apache License 2.0](https://github.com/gohugoio/hugo/blob/master/LICENSE).