Compare commits
No commits in common. "759907147c91dd06962b3bb359e37973435343e1" and "87ea8f601b75476b4fdad93d302b393750dbfdf2" have entirely different histories.
759907147c
...
87ea8f601b
8 changed files with 18 additions and 58 deletions
15
Dockerfile
15
Dockerfile
|
@ -1,24 +1,19 @@
|
||||||
FROM fukamachi/qlot
|
FROM fukamachi/qlot
|
||||||
|
|
||||||
ARG TW_VERSION=4.1.3
|
|
||||||
ARG TW_BIN=./bin/tailwindcss
|
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY . /app
|
COPY . /app
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y --no-install-recommends build-essential curl libev-dev
|
RUN apt-get update && apt-get install -y --no-install-recommends build-essential curl libev-dev
|
||||||
|
|
||||||
RUN mkdir -p ./bin \
|
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 \
|
&& 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 qlot install --quiet
|
||||||
|
|
||||||
RUN chmod +x /entrypoint.sh
|
|
||||||
|
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
|
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
ENTRYPOINT [".qlot/bin/clackup", "--system", "hp", "--server", "woo", "--address", "0.0.0.0", "--port", "3000", "src/app.lisp"]
|
||||||
|
|
|
@ -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
|
|
|
@ -13,28 +13,17 @@
|
||||||
#:~layout))
|
#:~layout))
|
||||||
(in-package #:hp/renderer)
|
(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)
|
(defmethod jingle:process-response ((app jingle:app) result)
|
||||||
(set-response-header :content-type "text/html; charset=utf-8")
|
(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
|
(call-next-method app
|
||||||
(hsx:render-to-string
|
(hsx:render-to-string
|
||||||
(match result
|
(match result
|
||||||
((plist :body body
|
((guard (or (list page metadata)
|
||||||
:metadata metadata
|
page)
|
||||||
:cache cache)
|
(typep page 'element))
|
||||||
(progn
|
(~layout :metadata metadata
|
||||||
(set-cache-control cache)
|
page))
|
||||||
(~layout :metadata metadata
|
|
||||||
body)))
|
|
||||||
(_ (error "Invalid response form"))))))
|
(_ (error "Invalid response form"))))))
|
||||||
|
|
|
@ -15,6 +15,4 @@
|
||||||
|
|
||||||
(defun handle-get (params)
|
(defun handle-get (params)
|
||||||
(declare (ignore params))
|
(declare (ignore params))
|
||||||
(list :body (~page)
|
(list (~page) *metadata*))
|
||||||
:metadata *metadata*
|
|
||||||
:cache :dynamic))
|
|
||||||
|
|
|
@ -15,6 +15,4 @@
|
||||||
|
|
||||||
(defun handle-get (params)
|
(defun handle-get (params)
|
||||||
(declare (ignore params))
|
(declare (ignore params))
|
||||||
(list :body (~page)
|
(list (~page) *metadata*))
|
||||||
:metadata *metadata*
|
|
||||||
:cache :dynamic))
|
|
||||||
|
|
|
@ -28,5 +28,4 @@
|
||||||
|
|
||||||
(defun handle-get (params)
|
(defun handle-get (params)
|
||||||
(declare (ignore params))
|
(declare (ignore params))
|
||||||
(list :body (~page)
|
(~page))
|
||||||
:cache :static))
|
|
||||||
|
|
|
@ -18,6 +18,4 @@
|
||||||
"Back to TOP"))))
|
"Back to TOP"))))
|
||||||
|
|
||||||
(defun handle-not-found ()
|
(defun handle-not-found ()
|
||||||
(list :body (~page)
|
(list (~page) *metadata*))
|
||||||
:metadata *metadata*
|
|
||||||
:cache :dynamic))
|
|
||||||
|
|
|
@ -15,6 +15,4 @@
|
||||||
|
|
||||||
(defun handle-get (params)
|
(defun handle-get (params)
|
||||||
(declare (ignore params))
|
(declare (ignore params))
|
||||||
(list :body (~page)
|
(list (~page) *metadata*))
|
||||||
:metadata *metadata*
|
|
||||||
:cache :dynamic))
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue