Building Hugo on Fedora 35

So I want to compile hugo from source in a container and get the following error:

STEP 5/13: WORKDIR "/app"
...
STEP 10/13: RUN ["/usr/bin/git", "clone", "--depth", "1", "--branch", "v0.94.2", "https://github.com/gohugoio/hugo.git"]
STEP 11/13: WORKDIR "/app/hugo"
STEP 12/13: ENV CGO_ENABLED="1"
STEP 13/13: RUN ["/usr/bin/go", "install", "--tags", "extended"]
go: golang.org/x/tools@v0.1.9 requires
	github.com/yuin/goldmark@v1.4.1: missing go.sum entry; to add it:
	go mod download github.com/yuin/goldmark
Error: error building at STEP "RUN /usr/bin/go install --tags extended": error while running runtime: exit status 1

Building Hugo missing dependencies · Issue #9690 · gohugoio/hugo · GitHub for reference.

1 Like

On a Raspberry Pi? Maybe have at least the OS and tools you are using at hand?

Sure, here is my Dockerfile

# syntax=docker/dockerfile:1
FROM fedora:35 AS base

LABEL maintainer="Silvio Knizek"
LABEL org.opencontainers.image.authors="Silvio Knizek"

RUN dnf -y update && dnf -y install gcc git golang nodejs python3-devel python3-pip python-wheel-wheel

WORKDIR "/app"

COPY requirements.txt requirements.txt
COPY package.json package.json

RUN ["/usr/bin/pip3", "install", "--target=python_modules", "--requirement=requirements.txt"]
RUN ["/usr/bin/npm", "install"]
RUN ["/usr/bin/git", "clone", "--depth", "1", "--branch", "v0.95.0", "https://github.com/gohugoio/hugo.git"]
WORKDIR "/app/hugo"
ENV CGO_ENABLED="1"
# See https://discourse.gohugo.io/t/building-hugo-missing-dependencies/37738 on why this is needed
RUN ["/usr/bin/go", "mod", "download", "github.com/yuin/goldmark"]
RUN ["/usr/bin/go", "build", "-v", "--tags", "extended"]

Also if that happened around 12 to 24 hours ago it might be, that you didn’t get the modules downloaded. Github had issues with the API and SSL connections.

Could you maybe put that and requirements.txt/packages.json into a public repository? It fails for me at the requirements setup when I try to build.

I can give you the files here, as this is a company internal repo which I can’t share.
requirements.txt

python-keystoneclient
python-swiftclient
pyyaml
toml

package.json

{
  "devDependencies": {
    "autoprefixer": "^10.4.2",
    "husky": "^7.0.4",
    "postcss": "^8.4.5",
    "postcss-cli": "^9.1.0",
    "remark": "^14.0.2",
    "remark-cli": "^10.0.1",
    "remark-frontmatter": "^4.0.1",
    "remark-gfm": "^3.0.1",
    "remark-lint": "^9.1.1",
    "remark-lint-code-block-style": "^3.1.0",
    "remark-lint-emphasis-marker": "^3.1.1",
    "remark-lint-fenced-code-marker": "^3.1.1",
    "remark-lint-heading-style": "^3.1.1",
    "remark-lint-list-item-indent": "^3.1.1",
    "remark-lint-list-item-spacing": "^4.1.1",
    "remark-lint-maximum-heading-length": "^3.1.1",
    "remark-lint-maximum-line-length": "^3.1.2",
    "remark-lint-no-file-name-irregular-characters": "^2.1.1",
    "remark-lint-no-table-indentation": "^4.1.1",
    "remark-lint-no-undefined-references": "^4.1.1",
    "remark-lint-ordered-list-marker-style": "^3.1.1",
    "remark-lint-ordered-list-marker-value": "^3.1.1",
    "remark-lint-rule-style": "^3.1.1",
    "remark-lint-strikethrough-marker": "^2.1.1",
    "remark-lint-strong-marker": "^3.1.1",
    "remark-lint-table-cell-padding": "^4.1.2",
    "remark-lint-table-pipes": "^4.1.1",
    "remark-lint-unordered-list-marker-style": "^3.1.1",
    "remark-message-control": "^7.1.1",
    "remark-preset-lint-consistent": "^5.1.1",
    "remark-preset-lint-markdown-style-guide": "^5.1.2",
    "remark-preset-lint-recommended": "^6.1.2",
    "remark-validate-links": "^11.0.2"
  },
  "dependencies": {
    "graphre": "^0.1.3",
    "jquery": "^3.6.0",
    "mermaid": "^8.14.0",
    "nomnoml": "^1.4.0"
  },
  "repository": {
    "type": "git",
    "url": "https://internal.github/org/repo"
  }
}

What is the Go version used?

1 Like

I meant like this:

Build Log (Click me)
> Executing task: docker build --pull --rm -f "Dockerfile" -t test:latest "." <

Sending build context to Docker daemon  64.51kB
Step 1/14 : FROM fedora:35 AS base
35: Pulling from library/fedora
Digest: sha256:40ba585f0e25c096a08c30ab2f70ef3820b8ea5a4bdd16da0edbfc0a6952fa57
Status: Image is up to date for fedora:35
 ---> b78af7a83692
Step 2/14 : LABEL maintainer="Silvio Knizek"
 ---> Using cache
 ---> 85f90ba71534
Step 3/14 : LABEL org.opencontainers.image.authors="Silvio Knizek"
 ---> Using cache
 ---> 9e13ce45aa1d
Step 4/14 : RUN dnf -y update && dnf -y install gcc git golang nodejs python3-devel python3-pip python-wheel-wheel
 ---> Using cache
 ---> 26f1d4aeb9d4
Step 5/14 : WORKDIR "/app"
 ---> Using cache
 ---> 39217942b1e5
Step 6/14 : COPY requirements.txt requirements.txt
 ---> d59b0f18923c
Step 7/14 : COPY package.json package.json
 ---> 83f97dcffb9d
Step 8/14 : RUN ["/usr/bin/pip3", "install", "--target=python_modules", "--requirement=requirements.txt"]
 ---> Running in 5b08be7c10e1
Collecting python-keystoneclient
  Downloading python_keystoneclient-4.4.0-py3-none-any.whl (398 kB)
Collecting python-swiftclient
  Downloading python_swiftclient-3.13.1-py2.py3-none-any.whl (87 kB)
Collecting pyyaml
  Downloading PyYAML-6.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (682 kB)
Collecting toml
  Downloading toml-0.10.2-py2.py3-none-any.whl (16 kB)
Collecting debtcollector>=1.2.0
  Downloading debtcollector-2.5.0-py3-none-any.whl (23 kB)
Collecting oslo.i18n>=3.15.3
  Downloading oslo.i18n-5.1.0-py3-none-any.whl (46 kB)
Collecting requests>=2.14.2
  Downloading requests-2.27.1-py2.py3-none-any.whl (63 kB)
Collecting oslo.serialization!=2.19.1,>=2.18.0
  Downloading oslo.serialization-4.3.0-py3-none-any.whl (25 kB)
Collecting six>=1.10.0
  Downloading six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting stevedore>=1.20.0
  Downloading stevedore-3.5.0-py3-none-any.whl (49 kB)
Collecting keystoneauth1>=3.4.0
  Downloading keystoneauth1-4.5.0-py3-none-any.whl (314 kB)
Collecting oslo.utils>=3.33.0
  Downloading oslo.utils-4.12.2-py3-none-any.whl (101 kB)
Collecting pbr!=2.1.0,>=2.0.0
  Downloading pbr-5.8.1-py2.py3-none-any.whl (113 kB)
Collecting oslo.config>=5.2.0
  Downloading oslo.config-8.8.0-py3-none-any.whl (128 kB)
Collecting wrapt>=1.7.0
  Downloading wrapt-1.14.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (77 kB)
Collecting iso8601>=0.1.11
  Downloading iso8601-1.0.2-py3-none-any.whl (9.7 kB)
Collecting os-service-types>=1.2.0
  Downloading os_service_types-1.7.0-py2.py3-none-any.whl (24 kB)
Collecting rfc3986>=1.2.0
  Downloading rfc3986-2.0.0-py2.py3-none-any.whl (31 kB)
Collecting netaddr>=0.7.18
  Downloading netaddr-0.8.0-py2.py3-none-any.whl (1.9 MB)
Collecting msgpack>=0.5.2
  Downloading msgpack-1.0.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (323 kB)
Collecting pytz>=2013.6
  Downloading pytz-2021.3-py2.py3-none-any.whl (503 kB)
Collecting packaging>=20.4
  Downloading packaging-21.3-py3-none-any.whl (40 kB)
Collecting pyparsing>=2.1.0
  Downloading pyparsing-3.0.7-py3-none-any.whl (98 kB)
Collecting netifaces>=0.10.4
  Downloading netifaces-0.11.0.tar.gz (30 kB)
Collecting idna<4,>=2.5
  Downloading idna-3.3-py3-none-any.whl (61 kB)
Collecting urllib3<1.27,>=1.21.1
  Downloading urllib3-1.26.9-py2.py3-none-any.whl (138 kB)
Collecting certifi>=2017.4.17
  Downloading certifi-2021.10.8-py2.py3-none-any.whl (149 kB)
Collecting charset-normalizer~=2.0.0
  Downloading charset_normalizer-2.0.12-py3-none-any.whl (39 kB)
Using legacy 'setup.py install' for netifaces, since package 'wheel' is not installed.
Installing collected packages: wrapt, pyparsing, pbr, urllib3, pytz, packaging, oslo.i18n, netifaces, netaddr, iso8601, idna, debtcollector, charset-normalizer, certifi, stevedore, six, rfc3986, requests, pyyaml, oslo.utils, os-service-types, msgpack, oslo.serialization, oslo.config, keystoneauth1, toml, python-swiftclient, python-keystoneclient
  WARNING: Value for scheme.platlib does not match. Please report this to <https://github.com/pypa/pip/issues/10151>
  distutils: /tmp/pip-target-i3lzx7uv/lib64/python
  sysconfig: /tmp/pip-target-i3lzx7uv/lib/python
  WARNING: Additional context:
  user = False
  home = '/tmp/pip-target-i3lzx7uv'
  root = None
  prefix = None
    Running setup.py install for netifaces: started
    Running setup.py install for netifaces: finished with status 'done'
Successfully installed certifi-2021.10.8 charset-normalizer-2.0.12 debtcollector-2.5.0 idna-3.3 iso8601-1.0.2 keystoneauth1-4.5.0 msgpack-1.0.3 netaddr-0.8.0 netifaces-0.11.0 os-service-types-1.7.0 oslo.config-8.8.0 oslo.i18n-5.1.0 oslo.serialization-4.3.0 oslo.utils-4.12.2 packaging-21.3 pbr-5.8.1 pyparsing-3.0.7 python-keystoneclient-4.4.0 python-swiftclient-3.13.1 pytz-2021.3 pyyaml-6.0 requests-2.27.1 rfc3986-2.0.0 six-1.16.0 stevedore-3.5.0 toml-0.10.2 urllib3-1.26.9 wrapt-1.14.0
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
Removing intermediate container 5b08be7c10e1
 ---> ed93f97a8eba
Step 9/14 : RUN ["/usr/bin/npm", "install"]
 ---> Running in ef72d98fbe2e
npm WARN deprecated @braintree/sanitize-url@3.1.0: Potential XSS vulnerability patched in v6.0.0.

added 399 packages, and audited 400 packages in 1m

169 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
npm notice 
npm notice New minor version of npm available! 8.3.1 -> 8.5.5
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v8.5.5>
npm notice Run `npm install -g npm@8.5.5` to update!
npm notice 
Removing intermediate container ef72d98fbe2e
 ---> 812ee44aabf6
Step 10/14 : RUN ["/usr/bin/git", "clone", "--depth", "1", "--branch", "v0.95.0", "https://github.com/gohugoio/hugo.git"]
 ---> Running in 4fc29e6ef66c
Cloning into 'hugo'...
Note: switching to '9f2e76af65a16be13d7adef93e8a482513a73719'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

Removing intermediate container 4fc29e6ef66c
 ---> d4113be3c2ce
Step 11/14 : WORKDIR "/app/hugo"
 ---> Running in eb981d64c768
Removing intermediate container eb981d64c768
 ---> a6aa699ce8ae
Step 12/14 : ENV CGO_ENABLED="1"
 ---> Running in 2686fe96d6b1
Removing intermediate container 2686fe96d6b1
 ---> c3cf25e58823
Step 13/14 : RUN ["/usr/bin/go", "mod", "download", "github.com/yuin/goldmark"]
 ---> Running in 98d199a22177
Removing intermediate container 98d199a22177
 ---> f66265b027d7
Step 14/14 : RUN ["/usr/bin/go", "build", "-v", "--tags", "extended"]
 ---> Running in 8f9bbbc25049
go: downloading github.com/alecthomas/chroma v0.10.0
go: downloading github.com/bep/debounce v1.2.0
go: downloading github.com/fsnotify/fsnotify v1.5.1
go: downloading github.com/pkg/errors v0.9.1
go: downloading github.com/spf13/afero v1.8.1
go: downloading github.com/spf13/cobra v1.3.0
go: downloading github.com/spf13/fsync v0.9.0
go: downloading github.com/spf13/jwalterweatherman v1.1.0
go: downloading github.com/spf13/pflag v1.0.5
go: downloading golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
go: downloading golang.org/x/sys v0.0.0-20220209214540-3681064d5158
get "golang.org/x/sync": found meta tag vcs.metaImport{Prefix:"golang.org/x/sync", VCS:"git", RepoRoot:"https://go.googlesource.com/sync"} at //golang.org/x/sync?go-get=1
go: downloading github.com/pelletier/go-toml/v2 v2.0.0-beta.6
go: downloading github.com/spf13/cast v1.4.1
get "golang.org/x/sys": found meta tag vcs.metaImport{Prefix:"golang.org/x/sys", VCS:"git", RepoRoot:"https://go.googlesource.com/sys"} at //golang.org/x/sys?go-get=1
go: downloading github.com/gobwas/glob v0.2.3
verifying github.com/pelletier/go-toml/v2@v2.0.0-beta.6: checksum mismatch
        downloaded: h1:TA3qh4Cq1VOjh4AJnMHrUFbAsIbD7OnOvpaIRYsU0sI=
        go.sum:     h1:JFNqj2afbbhCqTiyN16D7Tudc/aaDzE2FBDk+VlBQnE=

SECURITY ERROR
This download does NOT match an earlier download recorded in go.sum.
The bits may have been replaced on the origin server, or an attacker may
have intercepted the download attempt.

For more information, see 'go help module-auth'.
The command '/usr/bin/go build -v --tags extended' returned a non-zero code: 1
The terminal process "/usr/bin/bash '-c', 'docker build --pull --rm -f "Dockerfile" -t test:latest "."'" terminated with exit code: 1.

It fails with a security error.

Step 13/13 : RUN ["/usr/bin/go", "version"]
 ---> Running in 46a442d2d436
go version go1.16.14 linux/amd64

with the dockerfile in the above repo

Latest Hugo needs >= Go 1.18.

2 Likes

I see. Thanks for the hint, I will switch to a different build environment.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.