I’m trying to install Hugo from source on Digital Ocean. The go install command is taking too long. The console times out. I notice there’s a docker file in the hugo source code that I cloned. After install docker.io, what command do I run to build hugo? There’s no information in the readme.md about this. I’ve seen a bunch of different commands on the internet in different places but they all have different flags and options with them.
Can someone clarify?
If you are using Linux on Digital Ocean, why don’t you try Prebuilt binaries or better, repository packages ?
Edit: However, do try Hugo mods docker.
I want to alter the source code. Therefore I can’t use the prebuilt binary.
If possible can you please answer the question or delete your previous response so people see the question has not been answered. Thank you
It was a relevant answer, no need to delete. Someone will eventually see your question, but it’s 10 hours since you posted, a little patience goes a long way.
I apologize for the misunderstanding. I didn’t see my request as being in anyway “impatient.” I answered his question (about why don’t I try prebuilt binary) and I used very polite language.
Let’s try to address this first before adding something else to the mix.
I suspect the long build time is due to limited system resources when building the extended version of Hugo.
When building the extended version, Go calls gcc to compile the c code for LibSass and the WebP encoder. LibSass has been EOL for several years, so you should be using Dart Sass instead.
If you don’t need WebP encoding, build the standard version of Hugo with:
go install github.com/gohugoio/hugo@latest
Even if you do need the extended version, the above would be a good test; you would know if c compilation is the bottleneck.
In fact, I did try to build the non-extended version and I ran into the same problem.
And now I’m actually into the same problem building with the Dockerfile on DigitalOcean. I think it probably is limited resources. However, I’ve seen other people complaining about building Hugo (there’s a few github issues on it).
I don’t think I have other options because I need/want to alter the source to include the
expvar package for monitoring, and I’m not able to build it.
Perhaps on systems with very limited resources. If your droplet can’t handle it, I’d suggest building locally. Or buy a bigger droplet.
I guess it’s the limited RAM on the Droplet (1 GB). The Disk Space is 25GB, which should be enough.
Thanks for the suggestion. Building locally is quite fast. I’d forgotten about the cross compile feature of Go.
After I read this, I think the miscommunication arose from a difference in etiquette on different web sites. For example, on StackOverflow, it’s entirely normal to delete posts. Maybe that’s not how things are done here. I apologize again for any miscommunication. It wasn’t intended to be an impatient comment but I can see how it might have violated etiquette of this website.
I’d suggest building locally and then transferring the results to the droplet. I have found that even though the overhead of Docker is less than many things, it’s enough to choke basic droplets and VPS’s. Information on the docker build command is linked below anyway:
I’m not an expert on it by any means so I’m probably not qualified to give sound advice on the matter.
Personally I’d try building it from source on a machine of an identical distro of your droplet, in a WSL instance or container, and copying out any binaries and libraries you see which belong to hugo, copying them into the same locations on the droplet. This may take some experimentation, but would yield a similar result without the overhead of Docker.