Fix Dockerfile
This commit is contained in:
parent
c8ab7e1349
commit
cb50ff863b
11 changed files with 72 additions and 93 deletions
14
Dockerfile
14
Dockerfile
|
@ -1,25 +1,19 @@
|
||||||
FROM fukamachi/qlot
|
FROM fukamachi/qlot
|
||||||
|
|
||||||
# 作業ディレクトリ
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# ソース全体をコピー
|
|
||||||
COPY . /app
|
COPY . /app
|
||||||
|
|
||||||
# Tailwind CLI をダウンロード&インストール
|
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/latest/download/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 ./bin/tailwindcss
|
&& mv tailwindcss-linux-x64 ./bin/tailwindcss
|
||||||
|
|
||||||
# Tailwind CSS をビルド(global.css -> dist.css)
|
|
||||||
RUN ./bin/tailwindcss -i ./public/style/global.css -o ./public/style/dist.css --minify
|
RUN ./bin/tailwindcss -i ./public/style/global.css -o ./public/style/dist.css --minify
|
||||||
|
|
||||||
# Qlot依存関係のインストール
|
RUN qlot install --quiet
|
||||||
RUN qlot install
|
|
||||||
|
|
||||||
# ポート開放
|
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
|
|
||||||
# アプリ起動
|
ENTRYPOINT [".qlot/bin/clackup", "--system", "hp", "--server", "woo", "--address", "0.0.0.0", "--port", "3000", "src/app.lisp"]
|
||||||
CMD [".qlot/bin/clackup", "--system", "hp", "--server", "woo", "--port", "3000", "src/app.lisp"]
|
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
@tailwind base;
|
@import "tailwindcss";
|
||||||
@tailwind components;
|
|
||||||
@tailwind utilities;
|
|
||||||
|
|
||||||
:root {
|
:root {
|
||||||
font-family: 'Noto Sans JP Variable', sans-serif;
|
font-family: 'Noto Sans JP Variable', sans-serif;
|
||||||
|
|
8
qlfile
8
qlfile
|
@ -1,11 +1,11 @@
|
||||||
ql fiveam
|
ql fiveam
|
||||||
ql cl-jingle
|
ql cl-jingle
|
||||||
git hsx https://github.com/skyizwhite/hsx.git
|
|
||||||
git ningle-fbr https://github.com/skyizwhite/ningle-fbr.git
|
|
||||||
git lack-mw https://github.com/skyizwhite/lack-mw.git
|
|
||||||
ql cl-ppcre
|
ql cl-ppcre
|
||||||
ql trivial-backtrace
|
|
||||||
ql trivia
|
ql trivia
|
||||||
ql cl-str
|
ql cl-str
|
||||||
ql quri
|
ql quri
|
||||||
ql clack
|
ql clack
|
||||||
|
git hsx https://github.com/skyizwhite/hsx.git
|
||||||
|
git ningle-fbr https://github.com/skyizwhite/ningle-fbr.git
|
||||||
|
git lack-mw https://github.com/skyizwhite/lack-mw.git
|
||||||
|
git trivial-backtrace https://github.com/hraban/trivial-backtrace.git
|
32
qlfile.lock
32
qlfile.lock
|
@ -10,26 +10,10 @@
|
||||||
(:class qlot/source/ql:source-ql
|
(:class qlot/source/ql:source-ql
|
||||||
:initargs (:%version :latest)
|
:initargs (:%version :latest)
|
||||||
:version "ql-2023-10-21"))
|
:version "ql-2023-10-21"))
|
||||||
("hsx" .
|
|
||||||
(:class qlot/source/git:source-git
|
|
||||||
:initargs (:remote-url "https://github.com/skyizwhite/hsx.git")
|
|
||||||
:version "git-4ff1c97e3ff727aa332995f5be4dcfb138a45d5f"))
|
|
||||||
("ningle-fbr" .
|
|
||||||
(:class qlot/source/git:source-git
|
|
||||||
:initargs (:remote-url "https://github.com/skyizwhite/ningle-fbr.git")
|
|
||||||
:version "git-bc87e5de01959cd99364bc14ad3eaf88e52e4478"))
|
|
||||||
("lack-mw" .
|
|
||||||
(:class qlot/source/git:source-git
|
|
||||||
:initargs (:remote-url "https://github.com/skyizwhite/lack-mw.git")
|
|
||||||
:version "git-77a0f436635e5beadaba3765492832704a015a3c"))
|
|
||||||
("cl-ppcre" .
|
("cl-ppcre" .
|
||||||
(:class qlot/source/ql:source-ql
|
(:class qlot/source/ql:source-ql
|
||||||
:initargs (:%version :latest)
|
:initargs (:%version :latest)
|
||||||
:version "ql-2024-10-12"))
|
:version "ql-2024-10-12"))
|
||||||
("trivial-backtrace" .
|
|
||||||
(:class qlot/source/ql:source-ql
|
|
||||||
:initargs (:%version :latest)
|
|
||||||
:version "ql-2023-02-14"))
|
|
||||||
("trivia" .
|
("trivia" .
|
||||||
(:class qlot/source/ql:source-ql
|
(:class qlot/source/ql:source-ql
|
||||||
:initargs (:%version :latest)
|
:initargs (:%version :latest)
|
||||||
|
@ -46,3 +30,19 @@
|
||||||
(:class qlot/source/ql:source-ql
|
(:class qlot/source/ql:source-ql
|
||||||
:initargs (:%version :latest)
|
:initargs (:%version :latest)
|
||||||
:version "ql-2024-10-12"))
|
:version "ql-2024-10-12"))
|
||||||
|
("hsx" .
|
||||||
|
(:class qlot/source/git:source-git
|
||||||
|
:initargs (:remote-url "https://github.com/skyizwhite/hsx.git")
|
||||||
|
:version "git-4ff1c97e3ff727aa332995f5be4dcfb138a45d5f"))
|
||||||
|
("ningle-fbr" .
|
||||||
|
(:class qlot/source/git:source-git
|
||||||
|
:initargs (:remote-url "https://github.com/skyizwhite/ningle-fbr.git")
|
||||||
|
:version "git-bc87e5de01959cd99364bc14ad3eaf88e52e4478"))
|
||||||
|
("lack-mw" .
|
||||||
|
(:class qlot/source/git:source-git
|
||||||
|
:initargs (:remote-url "https://github.com/skyizwhite/lack-mw.git")
|
||||||
|
:version "git-77a0f436635e5beadaba3765492832704a015a3c"))
|
||||||
|
("trivial-backtrace" .
|
||||||
|
(:class qlot/source/git:source-git
|
||||||
|
:initargs (:remote-url "https://github.com/hraban/trivial-backtrace.git")
|
||||||
|
:version "git-7f90b4a4144775cca0728791e4b92ac2557b07a1"))
|
||||||
|
|
25
src/app.lisp
25
src/app.lisp
|
@ -1,8 +1,11 @@
|
||||||
(defpackage #:hp/app
|
(defpackage #:hp/app
|
||||||
(:use #:cl)
|
(:use #:cl)
|
||||||
(:local-nicknames (#:jg #:jingle))
|
(:import-from #:jingle
|
||||||
(:local-nicknames (#:fbr #:ningle-fbr))
|
#:make-app
|
||||||
(:local-nicknames (#:env #:hp/env))
|
#:install-middleware
|
||||||
|
#:configure)
|
||||||
|
(:import-from #:ningle-fbr
|
||||||
|
#:set-routes)
|
||||||
(:import-from #:hp/middlewares/recoverer
|
(:import-from #:hp/middlewares/recoverer
|
||||||
#:*recoverer*)
|
#:*recoverer*)
|
||||||
(:import-from #:hp/middlewares/trailing-slash
|
(:import-from #:hp/middlewares/trailing-slash
|
||||||
|
@ -13,12 +16,12 @@
|
||||||
(:export #:*app*))
|
(:export #:*app*))
|
||||||
(in-package #:hp/app)
|
(in-package #:hp/app)
|
||||||
|
|
||||||
(defparameter *app* (jg:make-app :address env:*address*
|
(defparameter *app*
|
||||||
:port env:*port*))
|
(let ((app (make-app)))
|
||||||
|
(set-routes app :system :hp :target-dir-path "routes")
|
||||||
|
(install-middleware app *recoverer*)
|
||||||
|
(install-middleware app *trim-trailing-slash*)
|
||||||
|
(install-middleware app *public-server*)
|
||||||
|
(configure app)))
|
||||||
|
|
||||||
(fbr:set-routes *app* :system :hp :target-dir-path "routes")
|
*app*
|
||||||
(jg:install-middleware *app* *recoverer*)
|
|
||||||
(jg:install-middleware *app* *trim-trailing-slash*)
|
|
||||||
(jg:install-middleware *app* *public-server*)
|
|
||||||
|
|
||||||
(jg:configure *app*)
|
|
||||||
|
|
25
src/env.lisp
25
src/env.lisp
|
@ -1,25 +0,0 @@
|
||||||
(defpackage #:hp/env
|
|
||||||
(:use #:cl)
|
|
||||||
(:export #:dev-mode-p
|
|
||||||
#:prod-mode-p
|
|
||||||
#:*port*
|
|
||||||
#:*address*))
|
|
||||||
(in-package #:hp/env)
|
|
||||||
|
|
||||||
(defmacro defenv (name env &key default parser)
|
|
||||||
(let ((env-val (gensym "env-val")))
|
|
||||||
`(defparameter ,name
|
|
||||||
(let ((,env-val (uiop:getenv ,env)))
|
|
||||||
(if ,env-val
|
|
||||||
(funcall ,(or parser '#'identity) ,env-val)
|
|
||||||
,default)))))
|
|
||||||
|
|
||||||
(defenv *env* "HP_ENV" :default "dev")
|
|
||||||
(defenv *address* "HP_ADDRESS" :default "localhost")
|
|
||||||
(defenv *port* "HP_PORT" :default 3000 :parser #'parse-integer)
|
|
||||||
|
|
||||||
(defun dev-mode-p ()
|
|
||||||
(string= *env* "dev"))
|
|
||||||
|
|
||||||
(defun prod-mode-p ()
|
|
||||||
(string= *env* "prod"))
|
|
|
@ -1,8 +1,7 @@
|
||||||
(defpackage #:hp
|
(defpackage #:hp
|
||||||
(:nicknames #:hp/main)
|
(:nicknames #:hp/main)
|
||||||
(:use #:cl)
|
(:use #:cl)
|
||||||
(:local-nicknames (#:jg #:jingle))
|
(:import-from #:clack)
|
||||||
(:local-nicknames (#:env #:hp/env))
|
|
||||||
(:import-from #:hp/app
|
(:import-from #:hp/app
|
||||||
#:*app*)
|
#:*app*)
|
||||||
(:export #:start
|
(:export #:start
|
||||||
|
@ -10,11 +9,22 @@
|
||||||
#:reload))
|
#:reload))
|
||||||
(in-package #:hp)
|
(in-package #:hp)
|
||||||
|
|
||||||
|
(defparameter *handler* nil)
|
||||||
|
|
||||||
(defun start ()
|
(defun start ()
|
||||||
(jg:start *app*))
|
(if *handler*
|
||||||
|
(format t "The server is already running.~%")
|
||||||
|
(setf *handler* (clack:clackup *app*
|
||||||
|
:server :hunchentoot
|
||||||
|
:address "localhost"
|
||||||
|
:port 3000))))
|
||||||
|
|
||||||
(defun stop ()
|
(defun stop ()
|
||||||
(jg:stop *app*))
|
(if *handler*
|
||||||
|
(progn
|
||||||
|
(clack:stop *handler*)
|
||||||
|
(setf *handler* nil))
|
||||||
|
(format t "The server is not running.~%")))
|
||||||
|
|
||||||
(defun reload ()
|
(defun reload ()
|
||||||
(stop)
|
(stop)
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
(defpackage #:hp/middlewares/recoverer
|
(defpackage #:hp/middlewares/recoverer
|
||||||
(:use #:cl
|
(:use #:cl
|
||||||
#:hsx)
|
#:hsx)
|
||||||
(:local-nicknames (#:tb #:trivial-backtrace))
|
(:import-from #:trivial-backtrace
|
||||||
(:local-nicknames (#:env #:hp/env))
|
#:print-backtrace)
|
||||||
(:export #:*recoverer*))
|
(:export #:*recoverer*))
|
||||||
(in-package #:hp/middlewares/recoverer)
|
(in-package #:hp/middlewares/recoverer)
|
||||||
|
|
||||||
|
@ -14,10 +14,10 @@
|
||||||
(body
|
(body
|
||||||
(main
|
(main
|
||||||
(h1 "500 Internal Server Error")
|
(h1 "500 Internal Server Error")
|
||||||
(when (env:dev-mode-p)
|
(when (string= (uiop:getenv "HP_ENV") "dev")
|
||||||
(hsx
|
(hsx
|
||||||
(pre
|
(pre
|
||||||
(code (tb:print-backtrace condition :output nil))))))))))
|
(code (print-backtrace condition :output nil))))))))))
|
||||||
|
|
||||||
(defparameter *recoverer*
|
(defparameter *recoverer*
|
||||||
(lambda (app)
|
(lambda (app)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
(defpackage #:hp/middlewares/trailing-slash
|
(defpackage #:hp/middlewares/trailing-slash
|
||||||
(:use #:cl)
|
(:use #:cl)
|
||||||
(:local-nicknames (#:qu #:quri))
|
(:import-from :quri)
|
||||||
(:export #:*trim-trailing-slash*))
|
(:export #:*trim-trailing-slash*))
|
||||||
(in-package #:hp/middlewares/trailing-slash)
|
(in-package #:hp/middlewares/trailing-slash)
|
||||||
|
|
||||||
|
@ -10,8 +10,8 @@
|
||||||
(defparameter *trim-trailing-slash*
|
(defparameter *trim-trailing-slash*
|
||||||
(lambda (app)
|
(lambda (app)
|
||||||
(lambda (env)
|
(lambda (env)
|
||||||
(let* ((req-uri (qu:uri (getf env :request-uri)))
|
(let* ((req-uri (quri:uri (getf env :request-uri)))
|
||||||
(req-path (qu:uri-path req-uri))
|
(req-path (quri:uri-path req-uri))
|
||||||
(req-method (getf env :request-method))
|
(req-method (getf env :request-method))
|
||||||
(response (funcall app env))
|
(response (funcall app env))
|
||||||
(res-status (first response)))
|
(res-status (first response)))
|
||||||
|
@ -19,7 +19,7 @@
|
||||||
(eq req-method :get)
|
(eq req-method :get)
|
||||||
(not (string= req-path "/"))
|
(not (string= req-path "/"))
|
||||||
(string= (last-string req-path) "/"))
|
(string= (last-string req-path) "/"))
|
||||||
(let ((red-uri (qu:copy-uri req-uri
|
(let ((red-uri (quri:copy-uri req-uri
|
||||||
:path (string-right-trim "/" req-path))))
|
:path (string-right-trim "/" req-path))))
|
||||||
`(301 (:location ,(qu:render-uri red-uri))))
|
`(301 (:location ,(quri:render-uri red-uri))))
|
||||||
response)))))
|
response)))))
|
||||||
|
|
|
@ -2,10 +2,9 @@
|
||||||
(:use #:cl
|
(:use #:cl
|
||||||
#:hsx
|
#:hsx
|
||||||
#:trivia)
|
#:trivia)
|
||||||
(:local-nicknames (#:jg #:jingle))
|
(:import-from :jingle)
|
||||||
(:import-from #:hsx/element
|
(:import-from #:hsx/element
|
||||||
#:element)
|
#:element))
|
||||||
(:local-nicknames (#:env #:hp/env)))
|
|
||||||
(in-package #:hp/renderer)
|
(in-package #:hp/renderer)
|
||||||
|
|
||||||
(defun bust-cache (url)
|
(defun bust-cache (url)
|
||||||
|
@ -70,12 +69,12 @@
|
||||||
(main :class "flex-1 h-full"
|
(main :class "flex-1 h-full"
|
||||||
children)))))
|
children)))))
|
||||||
|
|
||||||
(defmethod jg:process-response ((app jg:app) result)
|
(defmethod jingle:process-response ((app jingle:app) result)
|
||||||
(jg:set-response-header :content-type "text/html; charset=utf-8")
|
(jingle:set-response-header :content-type "text/html; charset=utf-8")
|
||||||
(when (env:dev-mode-p)
|
(when (string= (uiop:getenv "HP_ENV") "dev")
|
||||||
(jg:set-response-header :cache-control "no-store, no-cache, must-revalidate")
|
(jingle:set-response-header :cache-control "no-store, no-cache, must-revalidate")
|
||||||
(jg:set-response-header :pragma "no-cache")
|
(jingle:set-response-header :pragma "no-cache")
|
||||||
(jg:set-response-header :expires "0"))
|
(jingle:set-response-header :expires "0"))
|
||||||
(call-next-method app
|
(call-next-method app
|
||||||
(hsx:render-to-string
|
(hsx:render-to-string
|
||||||
(match result
|
(match result
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
(defpackage #:hp/routes/not-found
|
(defpackage #:hp/routes/not-found
|
||||||
(:use #:cl
|
(:use #:cl
|
||||||
#:hsx)
|
#:hsx)
|
||||||
(:local-nicknames (#:jg #:jingle))
|
(:import-from :jingle)
|
||||||
(:export #:handle-not-found))
|
(:export #:handle-not-found))
|
||||||
(in-package #:hp/routes/not-found)
|
(in-package #:hp/routes/not-found)
|
||||||
|
|
||||||
|
@ -15,5 +15,5 @@
|
||||||
(h1 "404 Not Found"))))
|
(h1 "404 Not Found"))))
|
||||||
|
|
||||||
(defun handle-not-found ()
|
(defun handle-not-found ()
|
||||||
(jg:set-response-status :not-found)
|
(jingle:set-response-status :not-found)
|
||||||
(list (~page) *metadata*))
|
(list (~page) *metadata*))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue