From 04f5e775abb3083ae789ebe7f0d2bf9acba542fd Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Wed, 29 May 2024 22:27:19 +0800 Subject: [PATCH] chore: improve container config & shell script --- .devcontainer/devcontainer.json | 7 +++++-- .gitattributes | 1 + tools/run | 6 ++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index fa94020be57..492820ae17c 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,12 +1,14 @@ { "name": "Jekyll", "image": "mcr.microsoft.com/devcontainers/jekyll:2-bullseye", + "runArgs": ["--name", "${containerWorkspaceFolderBasename}"], "features": { "ghcr.io/devcontainers/features/node:1": { "version": "latest" } }, - "postCreateCommand": "npm i", + "onCreateCommand": "git config --global --add safe.directory ${containerWorkspaceFolder}", + "postStartCommand": "npm i", "customizations": { "vscode": { "settings": { @@ -42,7 +44,8 @@ "esbenp.prettier-vscode", "foxundermoon.shell-format", "stylelint.vscode-stylelint", - "yzhang.markdown-all-in-one" + "yzhang.markdown-all-in-one", + "mhutchie.git-graph" ] } } diff --git a/.gitattributes b/.gitattributes index 262d6bd7b86..135c4423ca2 100644 --- a/.gitattributes +++ b/.gitattributes @@ -4,6 +4,7 @@ # Force bash scripts to always use LF line endings so that if a repo is accessed # in Unix via a file share from Windows, the scripts will work. *.sh text eol=lf +tools/* text eol=lf # Force batch scripts to always use CRLF line endings so that if a repo is accessed # in Windows via a file share from Linux, the scripts will work. diff --git a/tools/run b/tools/run index 04f23f5e76b..3cb32901d04 100755 --- a/tools/run +++ b/tools/run @@ -46,5 +46,11 @@ if $prod; then command="JEKYLL_ENV=production $command" fi +if [ -e /proc/1/cgroup ]; then + if grep -q docker /proc/1/cgroup; then + command="$command --force_polling" + fi +fi + echo -e "\n> $command\n" eval "$command"