-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build(docker): come on, make it do something!
- Loading branch information
1 parent
0e0d1fd
commit 1c67e25
Showing
4 changed files
with
39 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
FROM pandoc/core:3.5 | ||
ENV CHROME_BIN="/usr/bin/chromium-browser" \ | ||
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD="true" | ||
USER root | ||
COPY build_docs.sh /root/build_docs.sh | ||
RUN apk add --update udev sudo bash git python3 ttf-freefont chromium npm && npm install -g [email protected] --unsafe-perm=true && chmod +x /root/build_docs.sh | ||
COPY build_docs_v2.py /root/build_docs_v2.py | ||
RUN apk add --update sudo bash git python3 ttf-freefont && chmod +x /root/build_docs_v2.py | ||
WORKDIR / | ||
ENTRYPOINT ["/bin/bash"] |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/usr/bin/python3 | ||
import datetime | ||
import pathlib | ||
from subprocess import Popen | ||
|
||
# find files with .md extension min depth 2 | ||
for path in pathlib.Path("/workspace").rglob("*/*.md"): | ||
print(f"Processing {path}...") | ||
# get the file's last modified time | ||
last_modified = datetime.datetime.fromtimestamp(path.stat().st_mtime).strftime("%Y-%m-%d %H:%M:%S") | ||
output_filename = path.parent / f"{path.stem}.html" | ||
Popen( | ||
[ | ||
"pandoc", | ||
"--template", | ||
"template.html", | ||
"--toc", | ||
"--katex=https://cdn.jsdelivr.net/npm/[email protected]/dist/", | ||
"--metadata", | ||
"toc-title=Indice", | ||
"--metadata", | ||
"lang=it", | ||
"--metadata", | ||
f"date={last_modified}", | ||
"--metadata", | ||
"maxwidth=100vw", | ||
"--verbose", | ||
"-o", | ||
output_filename, | ||
path, | ||
] | ||
).wait() | ||
|
||
print("Done! :)") | ||
# TODO: move index build process here |