Fix entry_point.sh docker backward compatibility problem (#2728)
This commit is contained in:
parent
6265269bd4
commit
c20074c8ca
@ -1,22 +1,34 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
CONFIG_FILE=_config.yml
|
CONFIG_FILE=_config.yml
|
||||||
|
|
||||||
/bin/bash -c "git restore Gemfile.lock && exec jekyll serve --watch --port=8080 --host=0.0.0.0 --livereload --verbose --trace --force_polling"&
|
# Function to manage Gemfile.lock
|
||||||
|
manage_gemfile_lock() {
|
||||||
|
git config --global --add safe.directory '*'
|
||||||
|
if command -v git &> /dev/null && [ -f Gemfile.lock ]; then
|
||||||
|
if git ls-files --error-unmatch Gemfile.lock &> /dev/null; then
|
||||||
|
echo "Gemfile.lock is tracked by git, keeping it intact"
|
||||||
|
git restore Gemfile.lock 2>/dev/null || true
|
||||||
|
else
|
||||||
|
echo "Gemfile.lock is not tracked by git, removing it"
|
||||||
|
rm Gemfile.lock
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
start_jekyll() {
|
||||||
|
manage_gemfile_lock
|
||||||
|
exec jekyll serve --watch --port=8080 --host=0.0.0.0 --livereload --verbose --trace --force_polling &
|
||||||
|
}
|
||||||
|
|
||||||
|
start_jekyll
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
|
inotifywait -q -e modify,move,create,delete $CONFIG_FILE
|
||||||
inotifywait -q -e modify,move,create,delete $CONFIG_FILE
|
if [ $? -eq 0 ]; then
|
||||||
|
echo "Change detected to $CONFIG_FILE, restarting Jekyll"
|
||||||
if [ $? -eq 0 ]; then
|
jekyll_pid=$(pgrep -f jekyll)
|
||||||
|
kill -KILL $jekyll_pid
|
||||||
echo "Change detected to $CONFIG_FILE, restarting Jekyll"
|
start_jekyll
|
||||||
|
fi
|
||||||
jekyll_pid=$(pgrep -f jekyll)
|
|
||||||
kill -KILL $jekyll_pid
|
|
||||||
|
|
||||||
/bin/bash -c "git restore Gemfile.lock && exec jekyll serve --watch --port=8080 --host=0.0.0.0 --livereload --verbose --trace --force_polling"&
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user