From 394c70454f8acccffc427423543063adb5c6393c Mon Sep 17 00:00:00 2001 From: venus Date: Tue, 3 Mar 2026 12:48:56 -0600 Subject: [PATCH] initial commit --- app/Dockerfile | 19 ++++++++++++ app/__pycache__/__init__.cpython-314.pyc | Bin 0 -> 414 bytes app/app.py | 35 +++++++++++++++++++++++ app/requirements.txt | 2 ++ compose.yml | 11 +++++++ content/test.md | 2 ++ 6 files changed, 69 insertions(+) create mode 100755 app/Dockerfile create mode 100644 app/__pycache__/__init__.cpython-314.pyc create mode 100644 app/app.py create mode 100755 app/requirements.txt create mode 100755 compose.yml create mode 100755 content/test.md diff --git a/app/Dockerfile b/app/Dockerfile new file mode 100755 index 0000000..2ac68fa --- /dev/null +++ b/app/Dockerfile @@ -0,0 +1,19 @@ +FROM python:3.10-slim AS builder + +ARG DEBUG_MODE=0 +ENV FLASK_DEBUG=$DEBUG_MODE + +ENV FLASK_APP=app.py + +WORKDIR /app +COPY . /app + +RUN pip3 install -r requirements.txt + + +EXPOSE 443 +ENTRYPOINT ["flask"] +CMD ["run", "--host=0.0.0.0", "--port=80"] +# CMD ["--app", ".", "run", "--host=0.0.0.0", "--port=443"] + + diff --git a/app/__pycache__/__init__.cpython-314.pyc b/app/__pycache__/__init__.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..be9913dbad68ab24cf3a1bcd4772334dbef02dba GIT binary patch literal 414 zcmYLEu}%U(5S?K;M2W=0gkYhfu^#+9fLbjalKf`4usLwA#$Ib3T)%l>kipDwdy1|V>-didG$eIEqIoo1z!AkI9 zv*9;e((}~e?zz%lztZ4-^93}K5?f#n_&|*$zm?-C;62rs{L)j`yzBd1h~an`3UTD$ zo5Fxx#2uMvitgA7sKqcVRP>5PXVsi>t|*+QBqlG!xI2Hello, World!" + +@app.route("/") +def index(): + # Write your markdown content + md_content = "# Welcome to my blog!\nThis is rendered from **Markdown**." + # Convert it to HTML + html_content = markdown.markdown(md_content) + return html_content + +@app.route ("/post/") +def render_markdown_file(filename): + filePath = CONTENT_DIR / f"{filename}.md" + # 3. Protect against missing files + if not filePath.is_file(): + return f"

404

Could not find {filename}.md in {filePath}

", 404 + # else: + # return f"

found

found {filename} in {filePath}

" + # 4. Open, read, and convert the file + with open(filePath, "r", encoding="utf-8") as f: + textContent = f.read() + + htmlContent = markdown.markdown(textContent) + + return htmlContent diff --git a/app/requirements.txt b/app/requirements.txt new file mode 100755 index 0000000..ad45c3c --- /dev/null +++ b/app/requirements.txt @@ -0,0 +1,2 @@ +flask +markdown diff --git a/compose.yml b/compose.yml new file mode 100755 index 0000000..25ca130 --- /dev/null +++ b/compose.yml @@ -0,0 +1,11 @@ +services: + ccu-host: + build: + # context: /home/venus/code/crimson-clinic/Dockerfile + context: app + args: + - DEBUG_MODE=1 + ports: + - '80:80' + volumes: + - ./content:/content diff --git a/content/test.md b/content/test.md new file mode 100755 index 0000000..10add8d --- /dev/null +++ b/content/test.md @@ -0,0 +1,2 @@ +# This is a test +and this is p \ No newline at end of file