Compare commits

..

No commits in common. "759907147c91dd06962b3bb359e37973435343e1" and "87ea8f601b75476b4fdad93d302b393750dbfdf2" have entirely different histories.

8 changed files with 18 additions and 58 deletions

View file

@ -1,24 +1,19 @@
FROM fukamachi/qlot
ARG TW_VERSION=4.1.3
ARG TW_BIN=./bin/tailwindcss
WORKDIR /app
COPY . /app
RUN apt-get update && apt-get install -y --no-install-recommends build-essential curl libev-dev
RUN mkdir -p ./bin \
&& curl -sLO https://github.com/tailwindlabs/tailwindcss/releases/download/v${TW_VERSION}/tailwindcss-linux-x64 \
&& curl -sLO https://github.com/tailwindlabs/tailwindcss/releases/latest/download/tailwindcss-linux-x64 \
&& chmod +x tailwindcss-linux-x64 \
&& mv tailwindcss-linux-x64 ${TW_BIN}
&& mv tailwindcss-linux-x64 ./bin/tailwindcss
RUN ${TW_BIN} -i ./static/style/global.css -o ./static/style/dist.css --minify
RUN ./bin/tailwindcss -i ./static/style/global.css -o ./static/style/dist.css --minify
RUN qlot install --quiet --no-color
RUN chmod +x /entrypoint.sh
RUN qlot install --quiet
EXPOSE 3000
ENTRYPOINT ["/entrypoint.sh"]
ENTRYPOINT [".qlot/bin/clackup", "--system", "hp", "--server", "woo", "--address", "0.0.0.0", "--port", "3000", "src/app.lisp"]

View file

@ -1,15 +0,0 @@
#!/bin/bash
set -e
if [[ -n "$CLOUDFLARE_ZONE_ID" && -n "$CLOUDFLARE_API_KEY" ]]; then
echo "Purging Cloudflare cache..."
curl -s -X POST "https://api.cloudflare.com/client/v4/zones/${CLOUDFLARE_ZONE_ID}/purge_cache" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${CLOUDFLARE_API_KEY}" \
-d '{ "hosts": ["skyizwhite.dev"] }'
else
echo "Cloudflare credentials not provided. Skipping cache purge."
fi
echo "Starting server..."
exec .qlot/bin/clackup --system hp --server woo --address 0.0.0.0 --port 3000 src/app.lisp

View file

@ -13,28 +13,17 @@
#:~layout))
(in-package #:hp/renderer)
(defun set-cache-control (strategy)
(set-response-header :cache-control
(if (string= (hp-env) "dev")
"private, no-store"
(cond
((eq strategy :static)
"public, max-age=60, s-maxage=31536000")
((eq strategy :dynamic)
"public, max-age=60 s-maxage=300, stale-while-revalidate=86400, stale-if-error=86400")
(t
"private, no-store")))))
(defmethod jingle:process-response ((app jingle:app) result)
(set-response-header :content-type "text/html; charset=utf-8")
(set-response-header :cache-control (if (string= (hp-env) "dev")
"private, no-store"
"public, max-age=60 s-maxage=300, stale-while-revalidate=86400, stale-if-error=86400"))
(call-next-method app
(hsx:render-to-string
(match result
((plist :body body
:metadata metadata
:cache cache)
(progn
(set-cache-control cache)
(~layout :metadata metadata
body)))
((guard (or (list page metadata)
page)
(typep page 'element))
(~layout :metadata metadata
page))
(_ (error "Invalid response form"))))))

View file

@ -15,6 +15,4 @@
(defun handle-get (params)
(declare (ignore params))
(list :body (~page)
:metadata *metadata*
:cache :dynamic))
(list (~page) *metadata*))

View file

@ -15,6 +15,4 @@
(defun handle-get (params)
(declare (ignore params))
(list :body (~page)
:metadata *metadata*
:cache :dynamic))
(list (~page) *metadata*))

View file

@ -28,5 +28,4 @@
(defun handle-get (params)
(declare (ignore params))
(list :body (~page)
:cache :static))
(~page))

View file

@ -18,6 +18,4 @@
"Back to TOP"))))
(defun handle-not-found ()
(list :body (~page)
:metadata *metadata*
:cache :dynamic))
(list (~page) *metadata*))

View file

@ -15,6 +15,4 @@
(defun handle-get (params)
(declare (ignore params))
(list :body (~page)
:metadata *metadata*
:cache :dynamic))
(list (~page) *metadata*))