From afd1d320d176d1febf7905a1fb3102a8a46fce2c Mon Sep 17 00:00:00 2001
From: Robby3St <35135025+Robby3St@users.noreply.github.com>
Date: Tue, 22 Apr 2025 22:51:26 +0200
Subject: [PATCH] feat(Dockerfile): add Dockerfile for local builds

---
 Dockerfile     | 25 +++++++++++++++++++++++++
 build.sh       |  2 +-
 entrypoint.sh  | 19 +++++++++++++++++++
 poetry.lock    |  4 ++--
 pyproject.toml |  2 +-
 5 files changed, 48 insertions(+), 4 deletions(-)
 create mode 100644 Dockerfile
 create mode 100755 entrypoint.sh

diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..8947740
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,25 @@
+FROM ubuntu:24.04
+WORKDIR /usr/local/bin
+
+RUN apt-get update && apt-get install -y python3.8 python3-pip pipx curl pandoc inotify-tools
+RUN pipx install poetry==2.0.0
+# Ensure pipx installs globally and the path is available
+ENV PIPX_BIN_DIR=/root/.local/bin
+ENV PATH=$PIPX_BIN_DIR:$PATH
+#texlive-latex-base texlive-fonts-recommended texlive-fonts-extra texlive-latex-extra curl
+# RUN python3 -m pip install poetry
+RUN curl -L -o decker https://github.com/decker-edu/decker/releases/download/latest/decker-latest-Linux-X64-3f4150d61ca167361b02665da969da769ca98e7c
+RUN chmod +x decker
+
+WORKDIR /usr/app
+VOLUME /usr/app/slides
+COPY . .
+RUN chmod +x entrypoint.sh
+
+EXPOSE 8888
+
+CMD [ "/usr/app/entrypoint.sh" ]
+# RUN /usr/local/bin/decker --server
+# RUN pandoc -t beamer output/fvv-folien-deck.md -o output/public/fvv-folien.pdf
+# RUN decker decks
+#
diff --git a/build.sh b/build.sh
index ca9bd13..c626eb2 100755
--- a/build.sh
+++ b/build.sh
@@ -8,7 +8,7 @@ echo "This is just a temporary directory for building the slides. This should be
 # Run python rendering
 echo "Install the python package."
 poetry install
-poetry run python render.py
+poetry run python $(pwd)/render.py
 
 # Merge all slide chunks into one output deck
 echo "Merge all slide chunks into one with the support of Pandoc."
diff --git a/entrypoint.sh b/entrypoint.sh
new file mode 100755
index 0000000..da69ac9
--- /dev/null
+++ b/entrypoint.sh
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+set -e
+
+echo "Starting initial build..."
+./build.sh
+
+echo "Starting Decker server in background..."
+cd output
+/usr/local/bin/decker --server &
+DECKER_PID=$!
+cd ..
+
+echo "Watching for slide changes..."
+while inotifywait -r -e modify,create,delete slides/; do
+    echo "Change detected. Rebuilding..."
+    ./build.sh
+done
+
diff --git a/poetry.lock b/poetry.lock
index f8bdf1e..adc7c0e 100644
--- a/poetry.lock
+++ b/poetry.lock
@@ -154,5 +154,5 @@ files = [
 
 [metadata]
 lock-version = "2.1"
-python-versions = ">=3.13"
-content-hash = "d989bba1d7bebb6c4da3b16985fd48500cce9011e55d875f48d7cae4c85b2c77"
+python-versions = ">=3.12"
+content-hash = "254a91d1ab66eefe761d354d9272529d8dbb4173136ee3ae72adc80e50e7bc7d"
diff --git a/pyproject.toml b/pyproject.toml
index 8fc6992..58f86ee 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -6,7 +6,7 @@ authors = [
     {name = "Robin Stecher"}
 ]
 readme = "README.md"
-requires-python = ">=3.13"
+requires-python = ">=3.12"
 dependencies = [
     "jinja2 (>=3.1.6,<4.0.0)",
     "pyyaml (>=6.0.2,<7.0.0)"
-- 
GitLab