/weblorg-docker

A companion container image for emacs-love/weblorg

Primary LanguageShellMIT LicenseMIT

weblorg-docker

A companion container image that helps to streamline the iteration loop when developing emacs-love/weblorg sites.

This repository has been forked from nanzhong/weblorg-docker in an effort to support more modern versions of emacs.

The image maker2413/weblorg is regularly built and pushed to Docker Hub. In general, maker2413/weblorg:latest should be stable and ready for use. However, tags also exist for versions 27 and 28 of emacs.

How it works

This container handles the rebuild iteration loop that’s typical of static site generator. It expects a weblorg site to be mounted in and it will watch for changes triggering rebuilds as necessary. It imposes very little assumptions to how the weblorg site is configured except that a self-contained emacs lisp file exists that defines the weblorg site. Pre and post build scripts are also supported if additional processing is needed.

The built static site is served using Caddy on port 80.

Included dependencies

  • Emacs
  • sass
  • Caddy

Usage

Development

Example usage

docker run \
       -v $(pwd -P):/workspace \
       -p 8080:80 \
       --rm \
       --name weblorg \
       maker2413/weblorg

This container image expects the weblorg site to be mounted as a volume into the container (by default to /workspace). A caddy file server serves the built static site on port 80. Any file changes will kick off a rebuild of the site.

One Time Build

docker run \
       -v $(pwd -P):/workspace \
       --rm \
       --name weblorg \
       maker2413/weblorg build

This foregoes the file watching and serving of the static site and instead just performs a one time build of the site.

Configuration

There are a number environment variables that can be set to configure the behavior. The defaults are shown below.

Env VarDefault ValueDescription
WORKSPACE/workspacePath in the container that the weblorg site is mounted to.
PRE_BUILD_SCRIPTpre.shPre-build script that will be run if it exists (e.g. sass compilation).
POST_BUILD_SCRIPTpost.shPost-build script that will be run if it exists (e.g. additional asset processing).
WEBLORG_DEFNpublish.elEmacs lisp script to run that contains the weblorg site definition.
WEBLORG_OUTPUT_PATHoutputThe directory configured in the weblorg site definition where the static site will be built to.