From 22ecd5eff5dd2454be8f1aab968ef76588a3b4e1 Mon Sep 17 00:00:00 2001 From: venus Date: Wed, 4 Mar 2026 15:47:53 -0600 Subject: [PATCH] refactoring into single directory and fixing docker --- app/Dockerfile | 10 +++++----- app/{app.py => ___init___.py} | 0 app/build.py | 26 ++++++++++++++++++++++++++ build.sh | 12 +++++++----- compose.yml | 11 +++++------ public_vault_builder/Dockerfile | 3 +++ public_vault_builder/build.py | 5 ++++- public_vault_builder/requirements.txt | 1 + 8 files changed, 51 insertions(+), 17 deletions(-) rename app/{app.py => ___init___.py} (100%) create mode 100644 app/build.py diff --git a/app/Dockerfile b/app/Dockerfile index ee0ca7a..821361c 100755 --- a/app/Dockerfile +++ b/app/Dockerfile @@ -2,20 +2,20 @@ FROM python:3.10-slim AS builder ARG DEBUG_MODE=0 ENV FLASK_DEBUG=$DEBUG_MODE +ENV FLASK_APP=app -ENV FLASK_APP=app.py -WORKDIR /app -COPY requirements.txt . +COPY requirements.txt RUN pip3 install -r requirements.txt COPY . . + EXPOSE 443 ENTRYPOINT ["flask"] -CMD ["run", "--host=0.0.0.0", "--port=80"] -# CMD ["--app", ".", "run", "--host=0.0.0.0", "--port=443"] +# CMD [ "run", "--host=0.0.0.0", "--port=80"] +CMD ["--app", "app", "run", "--host=0.0.0.0", "--port=443"] diff --git a/app/app.py b/app/___init___.py similarity index 100% rename from app/app.py rename to app/___init___.py diff --git a/app/build.py b/app/build.py new file mode 100644 index 0000000..fb829c5 --- /dev/null +++ b/app/build.py @@ -0,0 +1,26 @@ +from obsidian_parser import Vault +import shutil +from git import Repo + + + +def clone_secure_repo(url: str, token: str = "", dest: str): # clone a gittea repo using optional security token into dest dirand return a path to the directory + return dest + +def public_notes(src: str): # return a list of notes tagged with public from an obsidian directory + # build vault from source + vault = Vault(src) + if vault: + print ("found vault") + else: + print("could not find vault") + return [] + + # return a list ofnotes + return vault.get_notes_with_tag("public") + + +def buld_public_vault(src: str, dest: str): # build the public vault in dest from an obsidian repo in src + for note in public_notes(src): + print(note.title) + shutil.copy2(f"{note.path}", dest) diff --git a/build.sh b/build.sh index b01a858..09af6bc 100755 --- a/build.sh +++ b/build.sh @@ -6,10 +6,12 @@ if [ -z "$1" ]; then elif [ "$1" = "-b" ]; then build="--build" echo building -elif [ "$1" = "-d" ]; then - up="-d" - echo daemon +elif [ "$1" = "-i" ]; then + vaultPath="/home/venus/Documents/Personal-Wiki" + echo building fi -docker compose down -docker compose up $up $build +#update the .env + +#build public vault +docker compose up -d public_vault_builder diff --git a/compose.yml b/compose.yml index 52820a0..6841c41 100755 --- a/compose.yml +++ b/compose.yml @@ -8,9 +8,8 @@ services: - '80:80' volumes: - ./content:/content - public_vault_builder: - build: - context: public_vault_builder - volumes: - - ${obsidian_vault}:/vault - - ./public_vault:/content + # public_vault_builder: + # build: + # context: public_vault_builder + # volumes: + # - ./public_vault:/content diff --git a/public_vault_builder/Dockerfile b/public_vault_builder/Dockerfile index dddb043..329e7bd 100644 --- a/public_vault_builder/Dockerfile +++ b/public_vault_builder/Dockerfile @@ -1,5 +1,8 @@ FROM python:3.12-slim + +run mkdir /public-vault + WORKDIR /build COPY requirements.txt . diff --git a/public_vault_builder/build.py b/public_vault_builder/build.py index 8c7a83a..e1be12b 100644 --- a/public_vault_builder/build.py +++ b/public_vault_builder/build.py @@ -1,8 +1,11 @@ from obsidian_parser import Vault import shutil +from git import Repo + +# repo_url = "https://gitlab.com/username/my-vault.git" dest = "/content" -src = "/vault" +src = "Personal-Wiki" # Load a vault vault = Vault(src) diff --git a/public_vault_builder/requirements.txt b/public_vault_builder/requirements.txt index 2e7a966..b37b36e 100644 --- a/public_vault_builder/requirements.txt +++ b/public_vault_builder/requirements.txt @@ -1 +1,2 @@ obsidianmd-parser +GitPython