]> jfr.im git - irc/UndernetIRC/undernet-charter.git/commitdiff
Dockerize the project to make it easier to preview changes
authorStefan Wold <redacted>
Fri, 28 Jan 2022 14:17:50 +0000 (15:17 +0100)
committerStefan Wold <redacted>
Fri, 28 Jan 2022 14:17:50 +0000 (15:17 +0100)
Dockerfile [new file with mode: 0644]
README.md [new file with mode: 0644]
docker-compose.yaml [new file with mode: 0644]
rootfs/docker-entrypoint.d/command.sh [new file with mode: 0755]

diff --git a/Dockerfile b/Dockerfile
new file mode 100644 (file)
index 0000000..536b94d
--- /dev/null
@@ -0,0 +1,23 @@
+FROM alpine:latest
+
+ENV MKDOCS_VERSION=1.2.3 \
+    PYTHONUNBUFFERED=1
+
+
+RUN apk add --update \
+    ca-certificates \
+    python3 \
+    python3-dev \
+    py3-pip \
+    build-base && \
+    pip install --upgrade pip && \
+    pip install mkdocs==${MKDOCS_VERSION} \
+    mkdocs-material \
+    mkdocs-minify-plugin \
+    mkdocs-redirects \
+    mkdocs-enumerate-headings-plugin && \
+    rm -rf /tmp/* /var/tmp/* /var/cache/apk/* /var/cache/distfiles/*
+
+COPY rootfs /
+
+CMD [ "mkdocs", "serve", "--dev-addr", "0.0.0.0:8000" ]
diff --git a/README.md b/README.md
new file mode 100644 (file)
index 0000000..7497dab
--- /dev/null
+++ b/README.md
@@ -0,0 +1,34 @@
+# Undernet Document (db.undernet.org)
+
+## MkDocs
+
+The documentation is written in MarkDown and uses the [MkDocs](https://www.mkdocs.org/)
+framework. It currently capable of generating a searchable website and a PDF
+of the content.
+
+## Usage
+
+There are currently two ways to run MkDocs locally to preview changes in real-time.
+
+
+### Local installation 
+
+*Requirements:**
+
+- Python 3.x
+- pipenv
+- pango
+
+#### Installing MkDocs using pipenv
+
+`$ pipenv install`
+
+#### Running MkDocs
+
+`$ pipenv shell`
+`$ mkdocs serve`
+
+
+### Using docker and docker-compose
+
+`$ docker-compose up`
diff --git a/docker-compose.yaml b/docker-compose.yaml
new file mode 100644 (file)
index 0000000..386c11a
--- /dev/null
@@ -0,0 +1,12 @@
+version: '3'
+
+services:
+  mkdocs:
+    container_name: undernet-charter
+    working_dir: /app
+    build: .
+    restart: always
+    ports:
+      - "8000:8000"
+    volumes:
+      - ./:/app
diff --git a/rootfs/docker-entrypoint.d/command.sh b/rootfs/docker-entrypoint.d/command.sh
new file mode 100755 (executable)
index 0000000..32a958c
--- /dev/null
@@ -0,0 +1,13 @@
+#!/usr/bin/env bash
+
+set -e
+
+if [ "${1:0:1}" = '-' ]; then
+    set -- mkdocs "$@"
+fi
+
+case "$1" in
+    build|gh-deploy|new|serve)
+        set -- mkdocs "$@"
+    ;;
+esac