Skip to content

Commit

Permalink
Add Reload to Docker (Automatic Reload of Changes to _config.yaml) (a…
Browse files Browse the repository at this point in the history
  • Loading branch information
pourmand1376 authored and smeznar committed Dec 9, 2023
1 parent 9579537 commit a6069cb
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 33 deletions.
7 changes: 5 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@ RUN apt-get update -y && apt-get install -y --no-install-recommends \
ruby-full \
build-essential \
zlib1g-dev \
jupyter-nbconvert && \
jupyter-nbconvert \
inotify-tools procps && \
apt-get clean && rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/*


RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && \
locale-gen


ENV LANG=en_US.UTF-8 \
LANGUAGE=en_US:en \
LC_ALL=en_US.UTF-8 \
Expand All @@ -33,4 +36,4 @@ RUN bundle install --no-cache
# && rm -rf /var/lib/gems/3.1.0/cache
EXPOSE 8080

CMD ["/bin/bash", "-c", "rm -f Gemfile.lock && exec jekyll serve --watch --port=8080 --host=0.0.0.0 --livereload --verbose --trace"]
CMD ["./bin/entry_point.sh"]
5 changes: 0 additions & 5 deletions bin/docker_build_image.sh

This file was deleted.

8 changes: 0 additions & 8 deletions bin/docker_run.sh

This file was deleted.

8 changes: 0 additions & 8 deletions bin/dockerhub_run.sh

This file was deleted.

22 changes: 22 additions & 0 deletions bin/entry_point.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

CONFIG_FILE=_config.yml

/bin/bash -c "rm -f Gemfile.lock && exec jekyll serve --watch --port=8080 --host=0.0.0.0 --livereload --verbose --trace --force_polling"&

while true; do

inotifywait -q -e modify,move,create,delete $CONFIG_FILE

if [ $? -eq 0 ]; then

echo "Change detected to $CONFIG_FILE, restarting Jekyll"

jekyll_pid=$(pgrep -f jekyll)
kill -KILL $jekyll_pid

/bin/bash -c "rm -f Gemfile.lock && exec jekyll serve --watch --port=8080 --host=0.0.0.0 --livereload --verbose --trace --force_polling"&

fi

done
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ version: "3"
services:
jekyll:
image: amirpourmand/al-folio
build: .
ports:
- 8080:8080
volumes:
Expand Down
10 changes: 0 additions & 10 deletions docker-local.yml

This file was deleted.

0 comments on commit a6069cb

Please sign in to comment.