Upgrade to latest Go version + Some Docker image improvements (note)

* Rename /site to /project
* Add ldflags
* Add go and node to the default image
* Add Dart Sass to the default image
* Build the extended version by default
* Add "npm i" install support with custom entry script override
* Adjust cache logic to speed up CGO rebuilds

Closes #12920
See #12885
This commit is contained in:
Bjørn Erik Pedersen
2024-10-09 11:39:36 +02:00
parent 4a79956276
commit 41f69a7255
4 changed files with 111 additions and 32 deletions

21
scripts/docker/entrypoint.sh Executable file
View File

@@ -0,0 +1,21 @@
#!/bin/sh
# Check if a custom hugo-docker-entrypoint.sh file exists.
if [ -f hugo-docker-entrypoint.sh ]; then
# Execute the custom entrypoint file.
sh hugo-docker-entrypoint.sh "$@"
exit $?
fi
# Check if a package.json file exists.
if [ -f package.json ]; then
# Check if node_modules exists.
if [ ! -d node_modules ]; then
# Install npm packages.
# Note that we deliberately do not use `npm ci` here, as it would fail if the package-lock.json file is not up-to-date,
# which would be the case if you run the container with a different OS or architecture than the one used to create the package-lock.json file.
npm i
fi
fi
exec "hugo" "$@"