You've already forked hugo-docker
mirror of
https://github.com/jakejarvis/hugo-docker.git
synced 2025-07-02 01:06:41 -04:00
Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
1d0932a8be
|
|||
7087fafa01
|
|||
e79e76c961 | |||
a80a8bb35e |
52
.github/workflows/publish.yml
vendored
Normal file
52
.github/workflows/publish.yml
vendored
Normal 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
|
@ -3,7 +3,7 @@
|
||||
FROM golang:1.14-alpine
|
||||
|
||||
# the following version can be overridden at image build time with --build-arg
|
||||
ARG HUGO_VERSION=0.74.3
|
||||
ARG HUGO_VERSION=0.75.1
|
||||
# remove/comment the following line completely to build with vanilla Hugo:
|
||||
ARG HUGO_EXTENDED=1
|
||||
|
||||
|
14
README.md
14
README.md
@ -1,13 +1,15 @@
|
||||
# ✏️ [Hugo](https://github.com/gohugoio/hugo) via Docker
|
||||
# ✏️ [Hugo Extended](https://github.com/gohugoio/hugo) via Docker
|
||||
|
||||
[](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).
|
||||
|
Reference in New Issue
Block a user