Putting Hexo into Apptainer

Apptainer, formerly Singularity, is a great way to package up an application. Here is the definition file I created to provide a stable container for generating my blog even when my Linux distribution lands on a broken set of NodeJS, npm, and Hexo versions.

Container defintion:

1
2
3
4
5
6
7
8
9
BootStrap: docker
From: debian:stable

%post
apt update
apt install -y curl rsync less vim openssh-client
curl -fsSL https://deb.nodesource.com/setup_19.x | bash - && apt-get install -y nodejs
mkdir /usr/app && cd /usr/app
npm install -g hexo-cli hexo hexo-pagination hexo-generator-feed hexo-deployer-rsync

Building the container:

1
sudo apptainer build hexo.sif hexo.def

Using Hexo:

1
2
3
4
user@laptop:~$ apptainer shell hexo.sif
Apptainer> cd site
Apptainer> hexo generate
Apptainer> hexo deploy