Add Reload to Docker (Automatic Reload of Changes to _config.yaml) (#1702)
- #1640
This commit is contained in:
parent
dc3289ddfc
commit
c0bc95c5d9
|
|
@ -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 \
|
||||
|
|
@ -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"]
|
||||
|
|
|
|||
|
|
@ -227,12 +227,12 @@ You need to take the following steps to get `al-folio` up and running on your lo
|
|||
- Finally, run the following command that will pull the latest pre-built image from DockerHub and will run your website.
|
||||
|
||||
```bash
|
||||
$ docker-compose up
|
||||
$ docker compose up
|
||||
```
|
||||
|
||||
Note that when you run it for the first time, it will download a docker image of size 400MB or so.
|
||||
|
||||
Now, feel free to customize the theme however you like (don't forget to change the name!). After you are done, you can use the same command (`docker-compose up`) to render the webpage with all you changes. Also, make sure to commit your final changes.
|
||||
Now, feel free to customize the theme however you like (don't forget to change the name!). After you are done, you can use the same command (`docker compose up`) to render the webpage with all you changes. Also, make sure to commit your final changes.
|
||||
|
||||
> To change port number, you can edit `docker-compose.yml` file.
|
||||
|
||||
|
|
@ -243,7 +243,7 @@ Now, feel free to customize the theme however you like (don't forget to change t
|
|||
Build and run a new docker image using:
|
||||
|
||||
```bash
|
||||
$ docker-compose -f docker-local.yml up
|
||||
$ docker compose up --build
|
||||
```
|
||||
|
||||
> If you want to update jekyll, install new ruby packages, etc., all you have to do is build the image again using `--force-recreate` argument at the end of previous command! It will download ruby and jekyll and install all ruby packages again from scratch.
|
||||
|
|
|
|||
|
|
@ -1,5 +0,0 @@
|
|||
FILE=Gemfile.lock
|
||||
if [ -f "$FILE" ]; then
|
||||
rm $FILE
|
||||
fi
|
||||
docker build -t "al-folio:latest" .
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
FILE=Gemfile.lock
|
||||
if [ -f "$FILE" ]; then
|
||||
rm $FILE
|
||||
fi
|
||||
docker run --rm -v "$PWD:/srv/jekyll/" -p "8080:8080" \
|
||||
-it al-folio:latest bundler \
|
||||
exec jekyll serve --watch --port=8080 --host=0.0.0.0 \
|
||||
--verbose --livereload
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
FILE=Gemfile.lock
|
||||
if [ -f "$FILE" ]; then
|
||||
rm $FILE
|
||||
fi
|
||||
docker run --rm -v "$PWD:/srv/jekyll/" -p "8080:8080" \
|
||||
-it amirpourmand/al-folio bundler \
|
||||
exec jekyll serve --watch --port=8080 --host=0.0.0.0 \
|
||||
--verbose --livereload
|
||||
|
|
@ -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
|
||||
|
|
@ -3,6 +3,7 @@ version: "3"
|
|||
services:
|
||||
jekyll:
|
||||
image: amirpourmand/al-folio
|
||||
build: .
|
||||
ports:
|
||||
- 8080:8080
|
||||
volumes:
|
||||
|
|
|
|||
|
|
@ -1,10 +0,0 @@
|
|||
version: "3"
|
||||
|
||||
services:
|
||||
jekyll_custom:
|
||||
build: .
|
||||
image: al-folio-local-docker
|
||||
ports:
|
||||
- 8080:8080
|
||||
volumes:
|
||||
- .:/srv/jekyll
|
||||
Loading…
Reference in New Issue