Jekyll
This website is generated using Jekyll, a Ruby application. With the newer macOS and AlmaLinux versions that I run in my homelab, maintaining the proper version on each system became more and more cumbersome.
For this reason, I’m developing two Docker/Podman container images for Jekyll:
- jekyll-ruby33
- jekyll-ruby33-bundled
Note that the information below is still a work in progress; I may post an update in the (near) future.
jekyll-ruby33
The first image is based on a Red Hat UBI container image. It expects a “Gemfile” in the working directory where your website source code lives; see Containerfile below:
FROM registry.access.redhat.com/ubi9/ruby-33
# Copy the ENTRYPOINT script into the container
USER root
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
# Jekyll expects content here
VOLUME /work
WORKDIR /work
# Jekyll webserver runs on 4000/tcp
EXPOSE 4000
# Entrypoint performs "bundle install", expects Gemfile in toplevel directory
ENTRYPOINT ["/entrypoint.sh"]
CMD ["bundle", "exec", "jekyll", "serve", "--host", "0.0.0.0", "--port", "4000"]
The entrypoint script installs all dependencies at runtime, so container startup takes a while:
#!/bin/sh
set -e
echo "ENTRYPOINT: Checking for Gemfile"
if [ ! -f Gemfile ]; then
echo "ERROR - no Gemfile found!"
echo "Check your volume mounts or make sure there's a Jekyll site in this directory."
echo ""
echo " podman run -it --rm --volume $PWD:/work:Z -p 4000:4000 localhost/jekyll-ruby33:latest"
exit 1
fi
echo "ENTRYPOINT: Installing dependencies ..."
bundle install --retry 5 --jobs 20
echo ""
# Symlink as workaround for missing libsass.so (https://github.com/wildfly/wildfly.org/issues/424)
echo "ENTRYPOINT: Workaround for missing libsass.so if needed"
[ -f /usr/local/lib64/gems/ruby/sassc-2.4.0/sassc/libsass.so ] && \
ln -s /usr/local/lib64/gems/ruby/sassc-2.4.0/sassc/libsass.so /usr/local/share/gems/gems/sassc-2.4.0/lib/sassc/libsass.so && \
echo "ENTRYPOINT: Workaround applied, created symlink in /usr/local/share/gems/gems/sassc-2.4.0/lib/sassc/"
echo ""
echo "ENTRYPOINT: Display versions ..."
bundler -v
echo -n "Gem version "
gem -v
jekyll -v
echo ""
echo "ENTRYPOINT: Done. Running CMD"
exec "$@"
jekyll-ruby33-bundled
This container image is essentially the same as jekyll-ruby33, but the Gemfile dependencies are statically installed during build time. This makes it more suitable for CI/CD deployment pipelines.
FROM registry.access.redhat.com/ubi9/ruby-33
USER root
COPY Gemfile ./
RUN bundle install --retry 5 --jobs 20
# Symlink as workaround for missing libsass.so (https://github.com/wildfly/wildfly.org/issues/424)
RUN ln -s /usr/local/lib64/gems/ruby/sassc-2.4.0/sassc/libsass.so /usr/local/share/gems/gems/sassc-2.4.0/lib/sassc/libsass.so
# Jekyll expects content here
VOLUME /work
WORKDIR /work
# Jekyll webserver runs on 4000/tcp
EXPOSE 4000
# Explicitly run the server on http://0.0.0.0:4000 (all interfaces)
CMD ["bundle", "exec", "jekyll", "serve", "--host", "0.0.0.0", "--port", "4000"]