mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-05-17 18:25:26 +00:00
Update site/Dockerfile to use pinned hugo version
Version pinned in hack/go.mod. Use `make tools` to update the pinned version to match netlify.toml
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
.github
|
.github
|
||||||
docs
|
docs
|
||||||
examples
|
examples
|
||||||
site
|
|
||||||
travis
|
travis
|
||||||
*.md
|
*.md
|
||||||
|
|||||||
@@ -13,13 +13,11 @@ RUN apk add --no-cache \
|
|||||||
build-base \
|
build-base \
|
||||||
libc6-compat
|
libc6-compat
|
||||||
|
|
||||||
ARG HUGO_VERSION
|
RUN mkdir -p /go/src/sigs.k8s.io/kustomize/hack
|
||||||
|
WORKDIR /go/src/sigs.k8s.io/kustomize/hack
|
||||||
RUN mkdir $HOME/src && \
|
COPY hack/go.mod ./
|
||||||
cd $HOME/src && \
|
COPY hack/go.sum ./
|
||||||
curl -L https://github.com/gohugoio/hugo/archive/refs/tags/v${HUGO_VERSION}.tar.gz | tar -xz && \
|
RUN go install --tags extended github.com/gohugoio/hugo
|
||||||
cd "hugo-${HUGO_VERSION}" && \
|
|
||||||
go install --tags extended
|
|
||||||
|
|
||||||
FROM docker.io/library/golang:1.21-alpine
|
FROM docker.io/library/golang:1.21-alpine
|
||||||
|
|
||||||
@@ -32,8 +30,8 @@ RUN apk add --no-cache \
|
|||||||
|
|
||||||
RUN mkdir -p /usr/local/node_packages
|
RUN mkdir -p /usr/local/node_packages
|
||||||
WORKDIR /usr/local/node_packages
|
WORKDIR /usr/local/node_packages
|
||||||
COPY package.json ./
|
COPY site/package.json ./
|
||||||
COPY package-lock.json ./
|
COPY site/package-lock.json ./
|
||||||
RUN npm install -D autoprefixer postcss-cli
|
RUN npm install -D autoprefixer postcss-cli
|
||||||
ENV PATH="/usr/local/node_packages/node_modules/.bin:${PATH}"
|
ENV PATH="/usr/local/node_packages/node_modules/.bin:${PATH}"
|
||||||
|
|
||||||
|
|||||||
@@ -43,13 +43,23 @@ build-preview: module-check ## Build site with drafts and future posts enabled
|
|||||||
serve: module-check ## Boot the development server.
|
serve: module-check ## Boot the development server.
|
||||||
hugo server --buildFuture --environment development
|
hugo server --buildFuture --environment development
|
||||||
|
|
||||||
|
## Update the hugo version in ../hack/go.mod to match HUGO_VERSION in netlify.toml
|
||||||
|
.PHONY: tools
|
||||||
|
tools: netlify.toml
|
||||||
|
@echo "Hugo: v$(HUGO_VERSION)"
|
||||||
|
@set -euo pipefail && cd ../hack && \
|
||||||
|
sed -e "/github.com\/gohugoio\/hugo/ s/v[0-9]\+\.[0-9]\+\.[0-9]\+/v$(HUGO_VERSION)/" go.mod > go.mod.next && \
|
||||||
|
mv go.mod.next go.mod && \
|
||||||
|
echo "Updated ../hack/go.mod"
|
||||||
|
cd ../hack && go mod tidy
|
||||||
|
|
||||||
## Build a container image for the preview of the website
|
## Build a container image for the preview of the website
|
||||||
.PHONY: container-image
|
.PHONY: container-image
|
||||||
container-image: netlify.toml Dockerfile hugo.toml
|
container-image: tools Dockerfile hugo.toml
|
||||||
$(CONTAINER_ENGINE) build . \
|
cd .. && $(CONTAINER_ENGINE) build . \
|
||||||
|
--file site/Dockerfile \
|
||||||
--network=host \
|
--network=host \
|
||||||
--tag $(CONTAINER_IMAGE) \
|
--tag $(CONTAINER_IMAGE)
|
||||||
--build-arg HUGO_VERSION=$(HUGO_VERSION)
|
|
||||||
|
|
||||||
# no build lock to allow for read-only mounts
|
# no build lock to allow for read-only mounts
|
||||||
## Boot the development server using container.
|
## Boot the development server using container.
|
||||||
|
|||||||
@@ -60,6 +60,8 @@ If you see errors, it probably means that the hugo container did not have enough
|
|||||||
|
|
||||||
Open up your browser to <http://localhost:1313> to view the website. As you make changes to the source files, Hugo updates the website and forces a browser refresh.
|
Open up your browser to <http://localhost:1313> to view the website. As you make changes to the source files, Hugo updates the website and forces a browser refresh.
|
||||||
|
|
||||||
|
If you need to update the `HUGO_VERSION`, edit it in the [`netlify.toml`](netlify.toml#L7) file and then run `make tools` to update the pinned version of Hugo in [hack/go.mod](/hack/go.mod#L9).
|
||||||
|
|
||||||
## Running the website locally using Hugo
|
## Running the website locally using Hugo
|
||||||
|
|
||||||
Make sure to install the Hugo extended version specified by the `HUGO_VERSION` environment variable in the [`netlify.toml`](netlify.toml#L7) file.
|
Make sure to install the Hugo extended version specified by the `HUGO_VERSION` environment variable in the [`netlify.toml`](netlify.toml#L7) file.
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ command = "git submodule update --init --recursive --depth 1 && hugo"
|
|||||||
publish = "publishedSite/"
|
publish = "publishedSite/"
|
||||||
|
|
||||||
[build.environment]
|
[build.environment]
|
||||||
HUGO_VERSION = "0.120.3"
|
HUGO_VERSION = "0.120.4"
|
||||||
NODE_ENV = "development"
|
NODE_ENV = "development"
|
||||||
NETLIFY_BUILD_DEBUG = "true"
|
NETLIFY_BUILD_DEBUG = "true"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user