Compare commits
4 Commits
394c70454f
...
fix-docker
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
24b6b700be | ||
|
|
0d06f1c085 | ||
|
|
22ecd5eff5 | ||
|
|
0834ddc9cb |
@@ -2,18 +2,20 @@ FROM python:3.10-slim AS builder
|
|||||||
|
|
||||||
ARG DEBUG_MODE=0
|
ARG DEBUG_MODE=0
|
||||||
ENV FLASK_DEBUG=$DEBUG_MODE
|
ENV FLASK_DEBUG=$DEBUG_MODE
|
||||||
|
ENV FLASK_APP=app
|
||||||
|
|
||||||
ENV FLASK_APP=app.py
|
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
COPY . /app
|
COPY requirements.txt
|
||||||
|
|
||||||
RUN pip3 install -r requirements.txt
|
RUN pip3 install -r requirements.txt
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
|
||||||
EXPOSE 443
|
EXPOSE 443
|
||||||
ENTRYPOINT ["flask"]
|
ENTRYPOINT ["flask"]
|
||||||
CMD ["run", "--host=0.0.0.0", "--port=80"]
|
# CMD [ "run", "--host=0.0.0.0", "--port=80"]
|
||||||
# CMD ["--app", ".", "run", "--host=0.0.0.0", "--port=443"]
|
CMD ["--app", "app", "run", "--host=0.0.0.0", "--port=443"]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
26
app/build.py
Normal file
26
app/build.py
Normal file
@@ -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)
|
||||||
17
build.sh
Executable file
17
build.sh
Executable file
@@ -0,0 +1,17 @@
|
|||||||
|
#! /bin/sh
|
||||||
|
|
||||||
|
#check for user args
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
echo no args
|
||||||
|
elif [ "$1" = "-b" ]; then
|
||||||
|
build="--build"
|
||||||
|
echo building
|
||||||
|
elif [ "$1" = "-i" ]; then
|
||||||
|
vaultPath="/home/venus/Documents/Personal-Wiki"
|
||||||
|
echo building
|
||||||
|
fi
|
||||||
|
|
||||||
|
#update the .env
|
||||||
|
|
||||||
|
#build public vault
|
||||||
|
docker compose up -d public_vault_builder
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
services:
|
services:
|
||||||
ccu-host:
|
app:
|
||||||
build:
|
build:
|
||||||
# context: /home/venus/code/crimson-clinic/Dockerfile
|
|
||||||
context: app
|
context: app
|
||||||
args:
|
args:
|
||||||
- DEBUG_MODE=1
|
- DEBUG_MODE=1
|
||||||
@@ -9,3 +8,8 @@ services:
|
|||||||
- '80:80'
|
- '80:80'
|
||||||
volumes:
|
volumes:
|
||||||
- ./content:/content
|
- ./content:/content
|
||||||
|
# public_vault_builder:
|
||||||
|
# build:
|
||||||
|
# context: public_vault_builder
|
||||||
|
# volumes:
|
||||||
|
# - ./public_vault:/content
|
||||||
|
|||||||
3
content/index.md
Executable file
3
content/index.md
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
# This is a test
|
||||||
|
and this is p
|
||||||
|
*italics*
|
||||||
@@ -1,2 +1,3 @@
|
|||||||
# This is a test
|
# This is a test
|
||||||
and this is p
|
and this is p
|
||||||
|
*italics*
|
||||||
|
|||||||
14
public_vault_builder/Dockerfile
Normal file
14
public_vault_builder/Dockerfile
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
FROM python:3.12-slim
|
||||||
|
|
||||||
|
|
||||||
|
run mkdir /public-vault
|
||||||
|
|
||||||
|
WORKDIR /build
|
||||||
|
|
||||||
|
COPY requirements.txt .
|
||||||
|
|
||||||
|
RUN pip3 install -r requirements.txt
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
CMD ["python", "build.py"]
|
||||||
25
public_vault_builder/build.py
Normal file
25
public_vault_builder/build.py
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
from obsidian_parser import Vault
|
||||||
|
import shutil
|
||||||
|
from git import Repo
|
||||||
|
|
||||||
|
|
||||||
|
# repo_url = "https://gitlab.com/username/my-vault.git"
|
||||||
|
dest = "/content"
|
||||||
|
src = "Personal-Wiki"
|
||||||
|
# Load a vault
|
||||||
|
vault = Vault(src)
|
||||||
|
|
||||||
|
if vault:
|
||||||
|
print ("found vault")
|
||||||
|
else:
|
||||||
|
print("could not find vault")
|
||||||
|
|
||||||
|
# Find notes by exact name
|
||||||
|
note = vault.get_note("test")
|
||||||
|
|
||||||
|
# Findd all public notes
|
||||||
|
publicNotes = vault.get_notes_with_tag("public")
|
||||||
|
|
||||||
|
for note in publicNotes:
|
||||||
|
print(note.title)
|
||||||
|
shutil.copy2(f"{note.path}", dest)
|
||||||
2
public_vault_builder/requirements.txt
Normal file
2
public_vault_builder/requirements.txt
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
obsidianmd-parser
|
||||||
|
GitPython
|
||||||
22
readme.md
Normal file
22
readme.md
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
# Architecture
|
||||||
|
/app
|
||||||
|
> containts all of the files to build and run the docker container.Docker containter runs the application
|
||||||
|
/content
|
||||||
|
> contains all of the publicly accessible files
|
||||||
|
templates
|
||||||
|
notes
|
||||||
|
index
|
||||||
|
...
|
||||||
|
compose # compose file to mount content to app
|
||||||
|
build.sh #optional file to build the app
|
||||||
|
.env # enviroment var files for location of existing public directory. will depricate
|
||||||
|
|
||||||
|
|
||||||
|
# Dockerfile
|
||||||
|
> builds the flask application and sets it to run.
|
||||||
|
- runs the site
|
||||||
|
|
||||||
|
# app
|
||||||
|
- clones the public repo (from env var url)
|
||||||
|
- finds public notes and moves to content vault
|
||||||
|
- exposes webhook to update vault and public notes
|
||||||
Reference in New Issue
Block a user