Sure, it is a pretty straightforward and easy docker build. It uses the Dockerfile as well as a file called init-and-run-wiki, which is a shell script to setup the node v8 memory management and the initialization lines to run the server.
Dockerfile:
FROM node:alpine
RUN npm install -g tiddlywiki
WORKDIR /var/lib/tiddlywiki
# Add init-and-run script
ADD init-and-run-wiki /usr/local/bin/init-and-run-wiki
# Meta
CMD ["/usr/local/bin/init-and-run-wiki"]
EXPOSE 8080
init-and-run-wiki:
#!/bin/sh
set -e
tiddlywiki_script=$(readlink -f $(which tiddlywiki))
if [ -n "$NODE_MEM" ]; then
# Based on rule of thumb:
# This will determine the correct max_old_space_size depending on the memory of the system.
# This is to ensure th V8 engine does not crash your tiddlywiki process and ensure you do
# not run out of memory on the system.
mem_node_old_space=$((($NODE_MEM*4)/5))
NODEJS_V8_ARGS="--max_old_space_size=$mem_node_old_space $NODEJS_V8_ARGS"
fi
if [ ! -d /var/lib/tiddlywiki/mywiki ]; then
/usr/bin/env node $NODEJS_V8_ARGS $tiddlywiki_script mywiki --init server
mkdir /var/lib/tiddlywiki/mywiki/tiddlers
fi
# Start the tiddlywiki server
exec /usr/bin/env node $NODEJS_V8_ARGS $tiddlywiki_script mywiki --listen root-tiddler=$:/core/save/lazy-images host=0.0.0.0 port=8080 debug-level=${DEBUG_LEVEL-none}
Just put the Dockerfile in a directory with the init-and-run-wiki file and run:
docker build -t jbardi/tiddlywiki5-lazy-images:latest .
Or whatever name you want for your image
docker-compose.yml:
version: "2.4"
services:
tiddlywiki:
container_name: tiddlywiki
image: jbardi/tiddlywiki5-lazy-images:latest
volumes:
- [local folder path here]:/var/lib/tiddlywiki # i.e. /home/username/tiddlywiki:/var/lib/tiddlywiki
ports:
- 8080:8080
environment:
- TZ=America/Denver
restart: unless-stopped