diff options
author | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | 2018-05-28 20:53:00 +0200 |
---|---|---|
committer | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | 2018-05-28 20:53:13 +0200 |
commit | 9d5115e52c4c42af8249d8eb6f0ad3b8030f7c8d (patch) | |
tree | 3874790b285d3ef0817ea5f761a1c88a48a9070a | |
parent | 87d26e7b5b94bea662ffb23ef9cc9b6b9d849696 (diff) |
Add Dockerfile.
The Dockerfile uses deploy (https://shinmera.github.io/deploy/) to
create a self-contained binary and packages it as a Docker image.
-rw-r--r-- | .dockerignore | 5 | ||||
-rw-r--r-- | Dockerfile | 43 | ||||
-rw-r--r-- | mulkcms-ht.asd | 9 | ||||
-rw-r--r-- | mulkcms-hunchentoot.lisp | 9 | ||||
-rw-r--r-- | package-hunchentoot.lisp | 2 |
5 files changed, 66 insertions, 2 deletions
diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..93462d9 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,5 @@ +.* +Dockerfile +ChangeLog +COPYING* +bin diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..159f748 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,43 @@ +############### +### STAGE 0 ### +############### + +FROM mcreations/sbcl:1.4.1 + +RUN sbcl --eval "\ + (progn \ + (ql:quickload \"deploy\")) \ + " + +COPY . /opt/quicklisp/local-projects/mulkcms + +RUN sbcl --eval "\ + (progn \ + (ql:quickload \"mulkcms-ht\")) \ + " + +USER root +RUN mkdir -p /opt/quicklisp/local-projects/mulkcms/bin +RUN chown lisp /opt/quicklisp/local-projects/mulkcms/bin + +RUN sbcl --eval "\ + (progn \ + (asdf:make \"mulkcms-ht\")) \ + " + + +############### +### STAGE 1 ### +############### + +FROM debian:9-slim + +RUN apt-get update && apt-get install -y libssl1.0 && rm -rf /var/lib/apt/lists/* && apt-get clean + + +COPY --from=0 /opt/quicklisp/local-projects/mulkcms/bin /mulkcms/bin +COPY static-files /mulkcms/static-files +COPY templates /mulkcms/templates + +WORKDIR /mulkcms +ENTRYPOINT ["/mulkcms/bin/mulkcms-ht"] diff --git a/mulkcms-ht.asd b/mulkcms-ht.asd new file mode 100644 index 0000000..b02278a --- /dev/null +++ b/mulkcms-ht.asd @@ -0,0 +1,9 @@ +(asdf:defsystem mulkcms-ht + :version "0.0.1" + :depends-on (:mulkcms-hunchentoot) + :components () + + :defsystem-depends-on (:deploy) + :build-operation "deploy-op" + :build-pathname "mulkcms-ht" + :entry-point "mulkcms-hunchentoot:run-server") diff --git a/mulkcms-hunchentoot.lisp b/mulkcms-hunchentoot.lisp index 4300871..4d7f3c1 100644 --- a/mulkcms-hunchentoot.lisp +++ b/mulkcms-hunchentoot.lisp @@ -75,5 +75,12 @@ :port *server-port* :address *server-address*)) (setq mulkcms::*authorization-page-handler* #'handle-authorization-page) - (hunchentoot:start *acceptor*)) + (hunchentoot:start *acceptor*) + *acceptor*) +(defun run-server () + (let ((acceptor (start-server))) + (unwind-protect + (loop + (sleep 86400)) + (stop acceptor :soft t)))) diff --git a/package-hunchentoot.lisp b/package-hunchentoot.lisp index 955c25a..4843e0c 100644 --- a/package-hunchentoot.lisp +++ b/package-hunchentoot.lisp @@ -3,4 +3,4 @@ #:mulkcms) (:nicknames #:mulkcms-ht) (:shadow #:copy-file #:copy-stream) - (:export #:start-server)) + (:export #:start-server #:run-server)) |