| 1 |
#!/bin/sh |
| 2 |
|
| 3 |
# Check if a custom hugo-docker-entrypoint.sh file exists. |
| 4 |
if [ -f hugo-docker-entrypoint.sh ]; then |
| 5 |
# Execute the custom entrypoint file. |
| 6 |
sh hugo-docker-entrypoint.sh "$@" |
| 7 |
exit $? |
| 8 |
fi |
| 9 |
|
| 10 |
# Check if a package.json file exists. |
| 11 |
if [ -f package.json ]; then |
| 12 |
# Check if node_modules exists. |
| 13 |
if [ ! -d node_modules ]; then |
| 14 |
# Install npm packages. |
| 15 |
# 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, |
| 16 |
# 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. |
| 17 |
npm i |
| 18 |
fi |
| 19 |
fi |
| 20 |
|
| 21 |
exec "hugo" "$@" |