modernleft-docs/Applications/quartz-docker.md

56 lines
1.7 KiB
Markdown
Raw Normal View History

2025-01-17 02:28:51 +00:00
---
title: quartz-docker
draft: false
date: 2025-01-16
---
2025-01-17 03:07:26 +00:00
# 📄 quartz-docker
2025-01-17 15:45:13 +00:00
[quartz-docker image](https://code.modernleft.org/gravityfargo/-/packages/container/quartz-docker/v4.4.0)
2025-01-17 15:48:51 +00:00
2025-01-17 16:24:01 +00:00
```bash
docker pull code.modernleft.org/gravityfargo/quartz-docker:v4.4.0
```
2025-01-17 03:07:26 +00:00
This project runs **Quartz 4**, a fast, batteries-included static site generator, inside a **Docker container**. It transforms Markdown content into a fully functional website.
## 🚀 Features
2025-01-17 15:45:13 +00:00
- configurable with environment variables
2025-01-17 15:59:26 +00:00
- node and nginx included
2025-01-17 15:48:51 +00:00
- configurable cron for job to pull and build site
2025-01-17 03:07:26 +00:00
## 🛠️ Getting Started
2025-01-17 16:24:01 +00:00
### 🐳 Docker Compose
2025-01-17 03:07:26 +00:00
2025-01-17 03:16:22 +00:00
See a list of all Environment Variables [[environment variables|here.]]
2025-01-17 15:59:26 +00:00
2025-01-17 15:55:13 +00:00
1. Create a data directory and pull your existing content
2025-01-17 15:59:26 +00:00
```bash
git clone https://code.modernleft.org/gravityfargo/modernleft-docs.git quartz
```
2025-01-17 15:55:13 +00:00
2. Create a `docker-compose.yml` file
2025-01-17 16:18:00 +00:00
#### Minimal
2025-01-17 16:01:02 +00:00
![[minimal docker-compose]]
2025-01-17 16:18:00 +00:00
2025-01-17 16:15:13 +00:00
##### `BASE_URL`
2025-01-17 16:18:00 +00:00
2025-01-17 16:15:13 +00:00
The only required variable is `BASE_URL`. The rest are set to the developer's [defaults](https://quartz.jzhao.xyz/configuration) `BASE_URL` sets both quartz's `baseUrl` as well as nginx's `server_name`.
2025-01-17 15:59:26 +00:00
2025-01-17 16:18:00 +00:00
#### Recommended
2025-01-17 16:15:13 +00:00
![[recommended docker-compose]]
2025-01-17 03:07:26 +00:00
2025-01-17 16:18:00 +00:00
##### node_modules volume
To keep the image small, `node_modules` are not included. When the container is run, they're downloaded to `/usr/share/nginx/html/node_modules`. You should keep them in a volume so that the modules persist between container runs.
##### [[cron]]
2025-01-17 16:20:09 +00:00
You should also set `ENABLE_CRON` to `true` and set `BUILD_SCHEDULE` to a cron expression to enable the schedule that `npx quartz build` is executed with. This will pull the latest content and build the site.