From 1af4af3bb57b5f8ca9596b5c4bdfec9d1e3b1d79 Mon Sep 17 00:00:00 2001 From: Noah Betzen Date: Mon, 3 Apr 2023 16:46:49 -0700 Subject: [PATCH] Add initial TiddlyWiki Dockerfile and docs --- Dockerfile | 21 ++++++++++ .../docker/Using TiddlyWiki with Docker.tid | 39 +++++++++++++++++++ editions/tw5.com/tiddlers/readme/ReadMe.tid | 4 ++ 3 files changed, 64 insertions(+) create mode 100644 Dockerfile create mode 100644 editions/tw5.com/tiddlers/docker/Using TiddlyWiki with Docker.tid diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..88e1c3cfa --- /dev/null +++ b/Dockerfile @@ -0,0 +1,21 @@ +# Adapted from: https://github.com/elasticdog/tiddlywiki-docker/blob/master/5/Dockerfile + +ARG NODE_LTS_VERSION=18 + +FROM node:${NODE_LTS_VERSION}-alpine + +ARG TIDDLYWIKI_VERSION=5.2.7 +ARG TIDDLYWIKI_DATA_DIR=/tiddlywiki +ARG TIDDLYWIKI_PORT=8080 + +# https://github.com/nodejs/docker-node/blob/master/docs/BestPractices.md#handling-kernel-signals +RUN apk add --no-cache tini +RUN npm install -g tiddlywiki@${TIDDLYWIKI_VERSION} + +EXPOSE ${TIDDLYWIKI_PORT} + +VOLUME ${TIDDLYWIKI_DATA_DIR} +WORKDIR ${TIDDLYWIKI_DATA_DIR} + +ENTRYPOINT ["/sbin/tini", "--", "tiddlywiki"] +CMD ["--help"] \ No newline at end of file diff --git a/editions/tw5.com/tiddlers/docker/Using TiddlyWiki with Docker.tid b/editions/tw5.com/tiddlers/docker/Using TiddlyWiki with Docker.tid new file mode 100644 index 000000000..16baec550 --- /dev/null +++ b/editions/tw5.com/tiddlers/docker/Using TiddlyWiki with Docker.tid @@ -0,0 +1,39 @@ +created: 20230403211230516 +modified: 20230403211230516 +tags: [[TiddlyWiki with Docker]] +title: Using TiddlyWiki with Docker +type: text/vnd.tiddlywiki + +~TiddlyWiki5 can also be run using Docker. See the [[Dockerfile]] for details. + +The image can be built using the following command in the root of the TiddlyWiki git repo: +``` +docker build --tag tiddlywiki . +``` + +It can be run like so: +``` +# Create a data directory +mkdir ~/tiddlywiki + +# Initialize the data directory +docker run \ + --rm \ + --name tiddlywiki \ + --volume ~/tiddlywiki:/tiddlywiki \ + tiddlywiki \ + mynewwiki --init server + +# Start the server with custom arguments +docker run \ + --rm \ + --name tiddlywiki \ + --volume ~/tiddlywiki:/tiddlywiki \ + --publish 8080:8080 \ + tiddlywiki \ + mynewwiki --listen host=0.0.0.0 port=8080 "readers=(anon)" "writers=(authenticated)" admin=noah username=noah password=noah +``` + +If you'd prefer a pre-built image, there is a community-maintained image on Docker Hub: https://hub.docker.com/r/elasticdog/tiddlywiki/ + +See [[Commands]] for a full listing of the available commands. diff --git a/editions/tw5.com/tiddlers/readme/ReadMe.tid b/editions/tw5.com/tiddlers/readme/ReadMe.tid index 615b3ab68..c27f3d385 100644 --- a/editions/tw5.com/tiddlers/readme/ReadMe.tid +++ b/editions/tw5.com/tiddlers/readme/ReadMe.tid @@ -32,6 +32,10 @@ Developer documentation is in progress at https://tiddlywiki.com/dev/ {{Upgrading TiddlyWiki on Node.js}} +! Using TiddlyWiki with Docker + +{{Using TiddlyWiki with Docker}} + ! Also see <>