Skip to content

Commit 3d3306f

Browse files
k-wallrobobario
authored andcommitted
feat: Mount the site on the Mac too.
Included a workaround for containers/podman#22343 that means incremental mode won't work properly on the Mac. Signed-off-by: Keith Wall <[email protected]>
1 parent 18b2119 commit 3d3306f

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ RUN ./bootstrap_setup.sh
4141

4242
RUN mkdir /site/
4343
WORKDIR /site/
44-
COPY . .
4544

4645
EXPOSE 4000
46+
# Note --incremental mode is ineffective on the Mac owing to https://github.com/containers/podman/issues/22343. Use force_regenerate.sh to trigger the incremental reload after changing the file on the host.
4747
CMD eval "$(rbenv init -)" && cp -r /css/_sass/bootstrap /site/_sass/ && bundle exec jekyll serve --host ${JEKYLL_SERVE_BIND} --incremental --disable-disk-cache --destination /tmp/site

force_regenerate.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
# Work around for the inability to utilise to Jekyll's incremental development
3+
# when running the website with the ./run.sh script on a Mac.
4+
# Edit the file as normal on the host then retrigger a rebuild:
5+
# force_regenerate.sh [<file glob>]
6+
# <file glob> defaults to *.markdown
7+
8+
NAME=${1:-*.markdown}
9+
podman exec jekll_serve find -type f -name "${NAME}" -exec touch {} \;

run.sh

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
#!/bin/bash
2+
# Runs the Kroxylicious website locally, for development purposes, within a container.
3+
# Point your browser at http://localhost:4000
4+
#
5+
# Jekyll is run on incremental mode so changes made to the host filesystem should be soon visible in your browser. Note however incremental mode won't work on Mac OS X (owing to http://github.com/containers/podman/issues/22343). Use the force_regenerate.sh to trigger the incremental reload after the edit is made on the host.
26
OS=$(uname)
37
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
48
cd ${SCRIPT_DIR}
@@ -7,12 +11,15 @@ CONTAINER_ENGINE=${CONTAINER_ENGINE:-podman}
711
RUN_ARGS=()
812
if [ "$OS" = 'Darwin' ]; then
913
RUN_ARGS+=(--env JEKYLL_SERVE_BIND=0.0.0.0 --publish 4000:4000)
10-
elif [ "$CONTAINER_ENGINE" = 'podman' ]; then
11-
RUN_ARGS+=(--net host -v $(pwd):/site/:Z)
1214
else
1315
RUN_ARGS+=(--net host)
1416
fi
15-
RUN_ARGS+=(--rm -it kroxylicious-website)
17+
18+
if [ "$CONTAINER_ENGINE" = 'podman' ]; then
19+
RUN_ARGS+=(-v $(pwd):/site/:Z)
20+
fi
21+
22+
RUN_ARGS+=(--rm --name jekll_serve -it kroxylicious-website)
1623

1724
${CONTAINER_ENGINE} build . -t kroxylicious-website
1825

0 commit comments

Comments
 (0)