From 3820214f238cad88e23c9d4853e62abbcada2dff Mon Sep 17 00:00:00 2001 From: tuxuser <462620+tuxuser@users.noreply.github.com> Date: Mon, 23 Dec 2024 01:38:11 +0100 Subject: [PATCH] feat: Added docker files and extended README with instructions --- Dockerfile | 18 +++++++++++ README.md | 75 +++++++++++++++++++++++++++++----------------- docker-compose.yml | 10 +++++++ 3 files changed, 76 insertions(+), 27 deletions(-) create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..1ac2fd5 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,18 @@ +FROM python:3.11-alpine + +RUN apk add git + +WORKDIR /wiki +COPY requirements.txt . +RUN pip install -U -r requirements.txt + +# Force /wiki directory to be considered safe for git +RUN git config --global --add safe.directory /wiki + +RUN echo $'#!/bin/sh\n\ + cd /wiki\n\ + mkdocs serve -a $(hostname -i):8000 --strict' > /docker-entrypoint.sh + +RUN chmod +x /docker-entrypoint.sh + +ENTRYPOINT ["/docker-entrypoint.sh"] \ No newline at end of file diff --git a/README.md b/README.md index 050a7f8..7c399b3 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Contributions are very welcome. Here's how you can help: - Correct spelling / grammar - Fix links -### Workflow +## Workflow 1. __Fork__ this repo 1. Make changes @@ -26,6 +26,7 @@ Contributions are very welcome. Here's how you can help: ### Step by step instructions **NOTE**: The following instructions are targeted towards Unix OS' - needed steps on windows may vary. + **NOTE 2**: You need python3 and python3-venv installed. Please look at your OS' package manager to find the correct packages. 1. At first: Fork the repository to your account! @@ -42,41 +43,20 @@ or git clone https://github.com//wiki.git ``` -3. Prepare your python virtual environment and dependencies +3. Navigate into wiki repository folder ```sh -# Navigate to the cloned repo cd wiki/ - -# Create a python3 virtual environment in your cloned repository -python -m venv venv - -# Activate the virtual environment -source venv/bin/activate ``` -4. Install needed python dependencies using python package manager -> pip +4. Choose one of the two deployment methods below. -```sh -pip install -r requirements.txt -``` +... DEPLOYMENT / STARTUP of mkdocs ... -5. At this point, load up the clone repository in a text editor that has live-markdown preview function. +5. At this point, load up the cloned repository in a text editor that has live-markdown preview function. - For example: Visual Studio Code. Instructions: (https://code.visualstudio.com/Docs/languages/markdown) -6. When you are done, use the following steps to build & preview the documentation / changes locally. - -Build the documentation -```sh -make build --strict -``` - -Serve the documentation -```sh -make serve --strict -``` - -7. Once you are happy and the added changes are looking proper, you are ready to submit your work. +6. Once you are happy and the added changes are looking proper, you are ready to submit your work. Add modified files for commiting ```sh @@ -100,3 +80,44 @@ git push ``` 8. Send a Pull Request :) + +## Deployment / Usage of mkdocs + +### Native deployment + +1. Create & activate python virtual-environment (might need dependency `python3-venv`, see: ) + +``` +python3 -m venv venv +source venv/bin/activate +``` + +2. Install mkdocs and dependencies + +``` +pip install -r requirements.txt +``` + +3. Edit docs and verify with the following commands: + +Serve the documentation () +``` +mkdocs serve --strict +``` + +Build the documentation +``` +mkdocs build --strict +``` + +### Docker deployment + +1. Execute docker container: + +``` +docker compose up +``` + +2. Navigate to +3. Make your changes and verify the formatting / linking still checks out. + diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..583e61b --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,10 @@ +version: "3" + +services: + wiki: + build: + context: . + ports: + - "127.0.0.1:8000:8000" + volumes: + - ./:/wiki