Add static site generator (Lektor)

This commit is contained in:
woju 2024-12-17 11:53:53 +01:00
parent 667c0a44cd
commit 7461ad1b74
Signed by untrusted user: woju
GPG key ID: 81E859ECD7FB4F51
8 changed files with 51 additions and 6 deletions

View file

@ -1,2 +1,33 @@
FROM nginxinc/nginx-unprivileged:1.25.2
COPY src /usr/share/nginx/html
FROM nginxinc/nginx-unprivileged:1.25.2-bookworm
ARG UID=101
ENV DEBIAN_FRONTEND=noninteractive
USER 0
RUN apt-get update \
&& apt-get install --no-install-recommends --no-install-suggests -y \
python3-venv \
python3-wheel \
rsync \
&& rm -rf /var/lib/apt/lists/*
RUN python3 -m venv /tmp/venv \
&& /tmp/venv/bin/pip3 install wheel \
&& /tmp/venv/bin/pip3 install lektor \
;
RUN mkdir -p /tmp/src
ADD assets/ /tmp/src/assets/
ADD content/ /tmp/src/content/
#ADD models/ /tmp/src/models/
ADD templates/ /tmp/src/templates/
ADD *.lektorproject /tmp/src/
WORKDIR /tmp/src
RUN /tmp/venv/bin/lektor build \
&& /tmp/venv/bin/lektor deploy docker \
;
USER $UID

View file

@ -4,10 +4,14 @@ List of all web services / app launcher
## Quick Start
There's no bundler, it's all vanilla html/css/js. You may run into CORS trouble just opening it
in the browser though. Use `npx serve src` or `python3 -m http.server -d src` to quickly spawn
a local web server.
It's a static site generator called [Lektor](https://getlektor.com). Use:
```sh
python3 -m venv venv
./venv/bin/pip3 install lektor
./venv/bin/lektor serve
```
to quickly spawn a local web server.
### How to add services?
Change `src/services.js`.
Change `contents/services.js`.

4
content/contents.lr Normal file
View file

@ -0,0 +1,4 @@
_model: none
---
_template: index.html
---

6
home.lektorproject Normal file
View file

@ -0,0 +1,6 @@
[project]
name = home
[servers.docker]
target = rsync:///usr/share/nginx/html
enabled = yes