first commit
This commit is contained in:
commit
0efeb5a25f
10 changed files with 231 additions and 0 deletions
0
.dockerignore
Normal file
0
.dockerignore
Normal file
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
|
5
.vscode/settings.json
vendored
Normal file
5
.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"[nginx]": {
|
||||
"editor.formatOnSave": false
|
||||
},
|
||||
}
|
65
Dockerfile
Normal file
65
Dockerfile
Normal file
|
@ -0,0 +1,65 @@
|
|||
FROM node:alpine AS build
|
||||
|
||||
RUN apk --no-cache add git && \
|
||||
git clone https://github.com/jackyzha0/quartz.git && \
|
||||
cd quartz && git checkout v4.4.0 && cd .. && \
|
||||
mkdir -p /usr/share/nginx/html && \
|
||||
mv quartz/* /usr/share/nginx/html && \
|
||||
rm -rf /usr/share/nginx/html/docs && \
|
||||
cd /usr/share/nginx/html && \
|
||||
npm ci && npx quartz build && \
|
||||
rm -rf /usr/share/nginx/html/node_modules
|
||||
|
||||
FROM nginx:stable-alpine3.20
|
||||
COPY --from=build /usr/share/nginx/html /usr/share/nginx/html
|
||||
COPY default.conf.template /etc/nginx/templates/default.conf.template
|
||||
|
||||
WORKDIR /usr/share/nginx/html
|
||||
|
||||
RUN apk --no-cache add nodejs npm bash dumb-init git && \
|
||||
rm -rf /var/cache/apk/*
|
||||
|
||||
RUN ln -s /usr/share/nginx/html/content / && \
|
||||
chown -R nginx:nginx /usr/share/nginx/html && \
|
||||
chown -R nginx:nginx /usr/share/nginx/html/content
|
||||
|
||||
ENV NGINX_PORT=80
|
||||
ENV BASE_URL="quartz.zhao.xyz"
|
||||
ENV PAGE_TITLE="Quartz Docker"
|
||||
ENV ENABLE_SPA="true"
|
||||
ENV ENABLE_POPOVERS="true"
|
||||
ENV ANALYTICS_PROVIDER="plausible"
|
||||
ENV IGNORE_PATTERNS="private,templates"
|
||||
ENV TYPOGRAPHY_HEADER="Schibsted Grotesk"
|
||||
ENV TYPOGRAPHY_BODY="Source Sans Pro"
|
||||
ENV TYPOGRAPHY_CODE="IBM-Plex Mono"
|
||||
ENV LIGHTMODE_LIGHT="#faf8f8"
|
||||
ENV LIGHTMODE_LIGHTGRAY="#e5e5e5"
|
||||
ENV LIGHTMODE_GRAY="#bbbbbb"
|
||||
ENV LIGHTMODE_DARKGRAY="#4e4e4e"
|
||||
ENV LIGHTMODE_DARK="#2b2b2b"
|
||||
ENV LIGHTMODE_SECONDARY="#284b63"
|
||||
ENV LIGHTMODE_TERTIARY="#84a59d"
|
||||
ENV LIGHTMODE_HIGHLIGHT="rgba(143,159,169,0.15)"
|
||||
ENV DARKMODE_LIGHT="#161618"
|
||||
ENV DARKMODE_LIGHTGRAY="#393639"
|
||||
ENV DARKMODE_GRAY="#646464"
|
||||
ENV DARKMODE_DARKGRAY="#4d4d4d"
|
||||
ENV DARKMODE_DARK="#ebebec"
|
||||
ENV DARKMODE_SECONDARY="#7b97aa"
|
||||
ENV DARKMODE_TERTIARY="#84a59d"
|
||||
ENV DARKMODE_HIGHLIGHT="rgba(143,159,169,0.15)"
|
||||
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
RUN chmod +x /entrypoint.sh
|
||||
|
||||
ENTRYPOINT ["dumb-init", "--"]
|
||||
|
||||
CMD ["/entrypoint.sh"]
|
||||
|
||||
|
||||
LABEL org.opencontainers.image.source="https://code.modernleft.org/gravityfargo/quartz-docker"
|
||||
LABEL org.opencontainers.image.url="https://quartz.jzhao.xyz/"
|
||||
LABEL org.opencontainers.image.description="A docker image for Quartz, a static site generator."
|
||||
LABEL org.opencontainers.image.licenses="MIT"
|
||||
LABEL org.opencontainers.image.authors="Nathan Price <gravityfargo@gmodernleft.org>"
|
21
LICENSE
Normal file
21
LICENSE
Normal file
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2025 Matthew (Nathan) Price
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
21
Makefile
Normal file
21
Makefile
Normal file
|
@ -0,0 +1,21 @@
|
|||
export DOCKER_BUILDKIT=1
|
||||
export COMPOSE_DOCKER_CLI_BUILD=1
|
||||
export BUILDKIT_PROGRESS=plain
|
||||
|
||||
TAG ?= dev
|
||||
|
||||
.PHONY: build
|
||||
build:
|
||||
docker build --tag code.modernleft.org/gravityfargo/quartz-docker:$(TAG) .
|
||||
|
||||
.PHONY: run
|
||||
run:
|
||||
docker compose up
|
||||
|
||||
.PHONY: exec
|
||||
run:
|
||||
docker exec -it quartz-docker bash
|
||||
|
||||
.PHONY: push
|
||||
push:
|
||||
docker push code.modernleft.org/gravityfargo/quartz-docker:$(TAG)
|
8
README.md
Normal file
8
README.md
Normal file
|
@ -0,0 +1,8 @@
|
|||
## Development
|
||||
|
||||
```bash
|
||||
# Build a development image
|
||||
make build
|
||||
# Build a specific version
|
||||
make build TAG=v4.4.0
|
||||
```
|
11
default.conf.template
Normal file
11
default.conf.template
Normal file
|
@ -0,0 +1,11 @@
|
|||
server {
|
||||
listen ${NGINX_PORT};
|
||||
server_name ${BASE_URL};
|
||||
root /usr/share/nginx/html/public;
|
||||
index index.html;
|
||||
error_page 404 /404.html;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri.html $uri/ =404;
|
||||
}
|
||||
}
|
39
docker-compose.yml
Normal file
39
docker-compose.yml
Normal file
|
@ -0,0 +1,39 @@
|
|||
services:
|
||||
quartz-docker:
|
||||
container_name: quartz-docker
|
||||
image: quartz-docker:dev
|
||||
ports:
|
||||
- 80:8080
|
||||
environment:
|
||||
NGINX_PORT: 8080
|
||||
PAGE_TITLE: "Quartz Docker"
|
||||
ENABLE_SPA: "true"
|
||||
ENABLE_POPOVERS: "true"
|
||||
ANALYTICS_PROVIDER: "plausible"
|
||||
BASE_URL: "localhost"
|
||||
IGNORE_PATTERNS: "private,templates"
|
||||
TYPOGRAPHY_HEADER: "Schibsted Grotesk"
|
||||
TYPOGRAPHY_BODY: "Source Sans Pro"
|
||||
TYPOGRAPHY_CODE: "IBM-Plex Mono"
|
||||
|
||||
# Light Mode Colors
|
||||
LIGHTMODE_LIGHT: "#faf8f8"
|
||||
LIGHTMODE_LIGHTGRAY: "#e5e5e5"
|
||||
LIGHTMODE_GRAY: "#bbbbbb"
|
||||
LIGHTMODE_DARKGRAY: "#4e4e4e"
|
||||
LIGHTMODE_DARK: "#2b2b2b"
|
||||
LIGHTMODE_SECONDARY: "#284b63"
|
||||
LIGHTMODE_TERTIARY: "#84a59d"
|
||||
LIGHTMODE_HIGHLIGHT: "rgba(143,159,169,0.15)"
|
||||
|
||||
# Dark Mode Colors
|
||||
DARKMODE_LIGHT: "#161618"
|
||||
DARKMODE_LIGHTGRAY: "#393639"
|
||||
DARKMODE_GRAY: "#646464"
|
||||
DARKMODE_DARKGRAY: "#4d4d4d"
|
||||
DARKMODE_DARK: "#ebebec"
|
||||
DARKMODE_SECONDARY: "#7b97aa"
|
||||
DARKMODE_TERTIARY: "#84a59d"
|
||||
DARKMODE_HIGHLIGHT: "rgba(143,159,169,0.15)"
|
||||
volumes:
|
||||
- /home/nathan/Repositories/modernleft-docs:/content
|
60
entrypoint.sh
Normal file
60
entrypoint.sh
Normal file
|
@ -0,0 +1,60 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
CONFIG_FILE="/usr/share/nginx/html/quartz.config.ts"
|
||||
TEMP_FILE="${CONFIG_FILE}.tmp"
|
||||
|
||||
replace_text() {
|
||||
local search="$1"
|
||||
local replace="$2"
|
||||
# file var with default value
|
||||
local file="${3:-$CONFIG_FILE}"
|
||||
|
||||
if [[ -z "$search" || -z "$replace" ]]; then
|
||||
echo "Error: Missing arguments"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Modify a temporary file instead of the original
|
||||
sed -e "s|${search}|${replace}|g" "$CONFIG_FILE" >"$TEMP_FILE" && mv "$TEMP_FILE" "$CONFIG_FILE"
|
||||
}
|
||||
# Quartz Config
|
||||
replace_text 'pageTitle: "🪴 Quartz 4.0",' "pageTitle: \"${PAGE_TITLE}\","
|
||||
replace_text 'enableSPA: true,' "enableSPA: ${ENABLE_SPA},"
|
||||
replace_text 'enablePopovers: true,' "enablePopovers: ${ENABLE_POPOVERS},"
|
||||
replace_text 'provider: "plausible",' "provider: \"${ANALYTICS_PROVIDER}\","
|
||||
replace_text 'baseUrl: "quartz.zhao.xyz",' "baseUrl: \"${BASE_URL}\","
|
||||
replace_text 'ignorePatterns: ["private", "templates"],' "ignorePatterns: [\"${IGNORE_PATTERNS//,/\", \"}\"],"
|
||||
replace_text 'header: "Schibsted Grotesk",' "header: \"${TYPOGRAPHY_HEADER}\","
|
||||
replace_text 'body: "Source Sans Pro",' "body: \"${TYPOGRAPHY_BODY}\","
|
||||
replace_text 'code: "IBM-Plex Mono",' "code: \"${TYPOGRAPHY_CODE}\","
|
||||
replace_text 'light: "#faf8f8",' "light: \"${LIGHTMODE_LIGHT}\","
|
||||
replace_text 'lightgray: "#e5e5e5",' "lightgray: \"${LIGHTMODE_LIGHTGRAY}\","
|
||||
replace_text 'gray: "#bbbbbb",' "gray: \"${LIGHTMODE_GRAY}\","
|
||||
replace_text 'darkgray: "#4e4e4e",' "darkgray: \"${LIGHTMODE_DARKGRAY}\","
|
||||
replace_text 'dark: "#2b2b2b",' "dark: \"${LIGHTMODE_DARK}\","
|
||||
replace_text 'secondary: "#284b63",' "secondary: \"${LIGHTMODE_SECONDARY}\","
|
||||
replace_text 'tertiary: "#84a59d",' "tertiary: \"${LIGHTMODE_TERTIARY}\","
|
||||
replace_text 'highlight: "rgba(143, 159, 169, 0.15)",' "highlight: \"${LIGHTMODE_HIGHLIGHT}\","
|
||||
replace_text 'light: "#161618",' "light: \"${DARKMODE_LIGHT}\","
|
||||
replace_text 'lightgray: "#393639",' "lightgray: \"${DARKMODE_LIGHTGRAY}\","
|
||||
replace_text 'gray: "#646464",' "gray: \"${DARKMODE_GRAY}\","
|
||||
replace_text 'darkgray: "#4d4d4d",' "darkgray: \"${DARKMODE_DARKGRAY}\","
|
||||
replace_text 'dark: "#ebebec",' "dark: \"${DARKMODE_DARK}\","
|
||||
replace_text 'secondary: "#7b97aa",' "secondary: \"${DARKMODE_SECONDARY}\","
|
||||
replace_text 'tertiary: "#84a59d",' "tertiary: \"${DARKMODE_TERTIARY}\","
|
||||
replace_text 'highlight: "rgba(143, 159, 169, 0.15)",' "highlight: \"${DARKMODE_HIGHLIGHT}\","
|
||||
chown nginx:nginx "$CONFIG_FILE"
|
||||
|
||||
# NGINX script to sub variables in the template
|
||||
/docker-entrypoint.d/20-envsubst-on-templates.sh
|
||||
|
||||
echo "Starting Quartz..."
|
||||
echo "Installing dependencies..."
|
||||
npm i >/dev/null
|
||||
|
||||
echo "Building Quartz..."
|
||||
npx quartz build
|
||||
|
||||
echo "Starting Nginx..."
|
||||
exec nginx -g "daemon off;"
|
Loading…
Reference in a new issue