Compare commits

..

5 commits

Author SHA1 Message Date
3b83c3c616
added cron for pull/build 2025-01-16 21:27:03 -05:00
d5fc422431
update 2025-01-16 21:26:44 -05:00
077690ef49
updated to proper image name 2025-01-16 21:26:30 -05:00
c7ca8b7103
put npm deps in a volume 2025-01-16 21:26:10 -05:00
7847efae6d
fixed exec target 2025-01-16 21:25:40 -05:00
5 changed files with 26 additions and 10 deletions

View file

@ -17,12 +17,14 @@ 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/*
rm -rf /var/cache/apk/* && \
echo "*/5 * * * * cd /usr/share/nginx/html/content && git pull >/dev/null 2>&1 && cd /usr/share/nginx/html && npx quartz build >/dev/null 2>&1" > /etc/crontabs/root
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 BUILD_SCHEDULE="*/5 * * * *"
ENV NGINX_PORT=80
ENV BASE_URL="quartz.zhao.xyz"
ENV PAGE_TITLE="Quartz Docker"

View file

@ -13,7 +13,7 @@ run:
docker compose up
.PHONY: exec
run:
exec:
docker exec -it quartz-docker bash
.PHONY: push

View file

@ -1,8 +1,6 @@
## Development
# quartz-docker
```bash
# Build a development image
make build
# Build a specific version
make build TAG=v4.4.0
```
Just a docker image for easy deployment of quartz,
[quartz Github](https://github.com/jackyzha0/quartz)
[quartz docs](https://quartz.jzhao.xyz/)

View file

@ -1,11 +1,13 @@
services:
quartz-docker:
container_name: quartz-docker
image: quartz-docker:dev
image: code.modernleft.org/gravityfargo/quartz-docker:dev
ports:
- 80:8080
environment:
NGINX_PORT: 8080
ENABLE_CRON: "false"
BUILD_SCHEDULE: "*/10 * * * *"
PAGE_TITLE: "Quartz Docker"
ENABLE_SPA: "true"
ENABLE_POPOVERS: "true"
@ -37,3 +39,8 @@ services:
DARKMODE_HIGHLIGHT: "rgba(143,159,169,0.15)"
volumes:
- /home/nathan/Repositories/modernleft-docs:/content
- quartz-deps:/usr/share/nginx/html/node_modules
volumes:
quartz-deps:
driver: local

View file

@ -18,6 +18,7 @@ replace_text() {
# 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},"
@ -46,9 +47,17 @@ replace_text 'tertiary: "#84a59d",' "tertiary: \"${DARKMODE_TERTIARY}\","
replace_text 'highlight: "rgba(143, 159, 169, 0.15)",' "highlight: \"${DARKMODE_HIGHLIGHT}\","
chown nginx:nginx "$CONFIG_FILE"
echo "${BUILD_SCHEDULE} cd /usr/share/nginx/html/content && git pull >/dev/null 2>&1 && cd /usr/share/nginx/html && npx quartz build >/dev/null 2>&1" >/etc/crontabs/root
# NGINX script to sub variables in the template
/docker-entrypoint.d/20-envsubst-on-templates.sh
# ENABLE_CRON
if [[ "$ENABLE_CRON" == "true" ]]; then
echo "Cron is enabled"
crond -b
fi
echo "Starting Quartz..."
echo "Installing dependencies..."
npm i >/dev/null