mirror of
https://github.com/alvierahman90/gronk.git
synced 2024-12-22 12:01:59 +00:00
dockerize
This commit is contained in:
parent
1eca81cd1d
commit
d83611f12a
4
.dockerignore
Normal file
4
.dockerignore
Normal file
@ -0,0 +1,4 @@
|
||||
.git
|
||||
.env
|
||||
env
|
||||
**/__pycache__
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,6 +1,7 @@
|
||||
*.swp
|
||||
.env
|
||||
env
|
||||
n
|
||||
web
|
||||
planning.txt
|
||||
__pycache__
|
||||
**/__pycache__
|
||||
|
28
Dockerfile
Normal file
28
Dockerfile
Normal file
@ -0,0 +1,28 @@
|
||||
FROM python:3.12-bookworm
|
||||
|
||||
ARG ARCH=
|
||||
|
||||
ENV BUILDARCH=${ARCH}
|
||||
ENV GRONK_CSS_DIR=./css
|
||||
ENV GRONK_JS_DIR=./js
|
||||
ENV GRONK_TEMPLATES_DIR=./templates
|
||||
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
RUN mkdir /notes
|
||||
RUN mkdir /web
|
||||
|
||||
VOLUME /usr/src/app/notes
|
||||
VOLUME /usr/src/app/web
|
||||
|
||||
RUN apt-get update \
|
||||
&& wget -O ./pandoc.deb https://github.com/jgm/pandoc/releases/download/3.1.11/pandoc-3.1.11-1-${BUILDARCH}.deb \
|
||||
&& apt install -y -f ./pandoc.deb \
|
||||
&& rm ./pandoc.deb
|
||||
|
||||
COPY requirements.txt ./
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
COPY . .
|
||||
|
||||
CMD [ "python3", "-u", "gronk.py", "--output-dir", "./web", "./notes" ]
|
11
docker-compose.yml
Normal file
11
docker-compose.yml
Normal file
@ -0,0 +1,11 @@
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
gronk:
|
||||
build:
|
||||
context: '.'
|
||||
args:
|
||||
ARCH: ${ARCH}
|
||||
volumes:
|
||||
- '${SOURCE}:/usr/src/app/notes'
|
||||
- '${OUTPUT}:/usr/src/app/web'
|
2
gronk.py
2
gronk.py
@ -28,8 +28,6 @@ GRONK_JS_DIR = Path(os.getenv("GRONK_JS_DIR", "/opt/gronk/js"))
|
||||
GRONK_TEMPLATES_DIR = Path(
|
||||
os.getenv("GRONK_TEMPLATES_DIR", "/opt/gronk/templates/"))
|
||||
|
||||
print(f"{GRONK_TEMPLATES_DIR=}")
|
||||
|
||||
JINJA_ENV = jinja2.Environment(
|
||||
loader=jinja2.FileSystemLoader(searchpath=GRONK_TEMPLATES_DIR),
|
||||
autoescape=jinja2.select_autoescape)
|
||||
|
37
readme.md
37
readme.md
@ -19,8 +19,30 @@ Tested with [pandoc v2.19.2](https://github.com/jgm/pandoc/releases/tag/2.19.2).
|
||||
|
||||
## Install
|
||||
|
||||
### Docker
|
||||
|
||||
Run the following, modifing the `-v` arguments as needed to mount the correct folders and
|
||||
setting the value of `ARCH` to either `amd64` or `arm64` as appropriate.
|
||||
|
||||
```
|
||||
docker build . -t gronk --build-arg ARCH=amd64
|
||||
docker run -v ./n:/usr/src/app/notes -v ./web:/usr/src/app/web gronk
|
||||
```
|
||||
|
||||
#### Compose
|
||||
|
||||
A [docker compose file](./docker-compose.yml) file has been provided.
|
||||
|
||||
Set the following environment variables (or create a .env file) and run `docker compose up`:
|
||||
|
||||
- `ARCH`
|
||||
- `SOURCE`
|
||||
- `OUTPUT`
|
||||
|
||||
### Locally
|
||||
|
||||
0. Install [Pandoc](https://pandoc.org/index.html) and [Pip](https://github.com/pypa/pip), python3-dev, and a C compiler
|
||||
1. Run `make install` as root
|
||||
1. `sudo make install`
|
||||
|
||||
## Other Things to Know
|
||||
|
||||
@ -98,7 +120,18 @@ $ gronk.py notes_directory
|
||||
|
||||
Output of `gronk.py --help`:
|
||||
|
||||
TODO add cli output
|
||||
```
|
||||
usage: gronk.py [-h] [-o OUTPUT_DIR] [-F] notes
|
||||
|
||||
positional arguments:
|
||||
notes
|
||||
|
||||
options:
|
||||
-h, --help show this help message and exit
|
||||
-o OUTPUT_DIR, --output-dir OUTPUT_DIR
|
||||
-F, --force Generate new output html even if source file was modified before output
|
||||
html
|
||||
```
|
||||
|
||||
The command will generate a website in the `output-dir` directory (`./web` by default).
|
||||
It will then generate a list of all note files and put it in `index.html`.
|
||||
|
Loading…
Reference in New Issue
Block a user