#!/bin/sh
for i in .jekyll-cache vendor vendor/bundle _site ; do
podman unshare mkdir -p "$(pwd)/${i}"
podman unshare chown -R $(id -u):$(id -u) "$(pwd)/${i}"
done
podman unshare chown -R $(id -u):$(id -u) "$(pwd)/Gemfile.lock"
podman images | grep -q jekyll || \
podman run \
--volume="$(pwd):/srv/jekyll:z" \
--volume="$(pwd)/vendor/bundle:/usr/local/bundle:z" \
--rm -it jekyll/jekyll bundle update
podman run \
--volume="$(pwd):/srv/jekyll:z" \
--volume="$(pwd)/vendor/bundle:/usr/local/bundle:z" \
-p 4000:4000/tcp \
--rm -it jekyll/jekyll jekyll serve