mirror of
https://github.com/gohugoio/hugo.git
synced 2025-04-29 07:00:31 +03:00
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:
parent
4a79956276
commit
41f69a7255
4 changed files with 111 additions and 32 deletions
21
scripts/docker/entrypoint.sh
Executable file
21
scripts/docker/entrypoint.sh
Executable 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" "$@"
|
20
scripts/docker/install_runtimedeps_default.sh
Executable file
20
scripts/docker/install_runtimedeps_default.sh
Executable file
|
@ -0,0 +1,20 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -ex
|
||||
|
||||
export DART_SASS_VERSION=1.79.3
|
||||
|
||||
# If $BUILDARCH=arm64, then we need to install the arm64 version of Dart Sass,
|
||||
# otherwise we install the x64 version.
|
||||
ARCH="x64"
|
||||
if [ "$BUILDARCH" = "arm64" ]; then
|
||||
ARCH="arm64"
|
||||
fi
|
||||
|
||||
cd /tmp
|
||||
curl -LJO https://github.com/sass/dart-sass/releases/download/${DART_SASS_VERSION}/dart-sass-${DART_SASS_VERSION}-linux-${ARCH}.tar.gz
|
||||
ls -ltr
|
||||
tar -xf dart-sass-${DART_SASS_VERSION}-linux-${ARCH}.tar.gz
|
||||
rm dart-sass-${DART_SASS_VERSION}-linux-${ARCH}.tar.gz && \
|
||||
# The dart-sass folder is added to the PATH by the caller.
|
||||
mv dart-sass /var/hugo/bin
|
Loading…
Add table
Add a link
Reference in a new issue