3.2 KiB
title | draft | date |
---|---|---|
quartz-docker | false | 2025-01-16 |
docker pull code.modernleft.org/gravityfargo/quartz-docker:v4.4.0
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.
While Quartz provides Docker support, it requires additional configuration. This container simplifies the process significantly.
🚀 Features
- Configurable with environment variables
- Node.js and Nginx included
- Configurable cron job to pull and build the site automatically
🛠️ Getting Started
🐳 Docker Compose
-
Create a data directory and pull your existing content:
git clone https://code.modernleft.org/gravityfargo/modernleft-docs.git quartz
-
Create a
docker-compose.yml
file:Minimal Example
version: "3" services: quartz: image: code.modernleft.org/gravityfargo/quartz-docker:v4.4.0 environment: - BASE_URL=https://example.com volumes: - ./quartz:/usr/share/nginx/html ports: - "80:80"
BASE_URL
The only required variable is
BASE_URL
. This sets both Quartz'sbaseUrl
and Nginx'sserver_name
.Recommended Setup
version: "3" services: quartz: image: code.modernleft.org/gravityfargo/quartz-docker:v4.4.0 environment: - BASE_URL=https://example.com - ENABLE_CRON=true - BUILD_SCHEDULE="0 * * * *" volumes: - ./quartz:/usr/share/nginx/html - node_modules:/usr/share/nginx/html/node_modules ports: - "80:80" volumes: node_modules:
Persistent
node_modules
VolumeTo keep the image small,
node_modules
are not included. When the container is run, they are downloaded to/usr/share/nginx/html/node_modules
. Mounting this as a volume ensures they persist between container runs, reducing setup time.Enabling Cron Jobs
Setting
ENABLE_CRON
totrue
and definingBUILD_SCHEDULE
as a cron expression allowsnpx quartz build
to run on a schedule. That command pulls the latest content and rebuilds the site.Example:
environment: - ENABLE_CRON=true - BUILD_SCHEDULE=" * * * *" # Runs every hour
📌 Environment Variables
See a list of all environment variables here.
Variable | Description | Default Value |
---|---|---|
BASE_URL |
The base URL for the site (Required) | None |
ENABLE_CRON |
Enables scheduled builds (true or false ) |
false |
BUILD_SCHEDULE |
Cron expression for scheduling site builds | 0 0 * * * (Daily at midnight) |
This setup ensures a fully automated Quartz deployment with minimal configuration.